Skip to content

Commit 7c3c46c

Browse files
aagam-shahclaude
andcommitted
Content Guidelines AI: fix remaining renamed-Gutenberg references
Two more leftovers from the Gutenberg content-guidelines -> guidelines rename, outside inject.js so missed by #49155: - suggestion-actions.jsx looked up the per-section form by the removed id `content-guidelines-${slug}`, so the effect bailed early: the original text was never captured for the diff and the form's has-jetpack-suggestion / is-jetpack-loading classes were never toggled (the underlying textarea stayed visible behind the suggestion). Switch to the stable `.guidelines__list-item[data-slug]` -> form lookup used by inject.js. - style.scss targeted the removed `.content-guidelines__accordion-trigger` class to hide the badge when a section is expanded. The badge is now injected inside the CollapsibleCard trigger, which carries aria-expanded, so target `[aria-expanded="true"]` instead. Both verified against the live page: the form resolves via data-slug and the badge-hide selector matches only when the section is expanded. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 60edab7 commit 7c3c46c

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

projects/plugins/jetpack/_inc/content-guidelines-ai/components/suggestion-actions.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export default function SuggestionActions( { slug } ) {
2323
// a separate React root injected into Gutenberg's page — we can't control classes
2424
// on Gutenberg-owned elements through React props.
2525
useEffect( () => {
26-
const form = document.getElementById( `content-guidelines-${ slug }` );
26+
const item = document.querySelector( `.guidelines__list-item[data-slug="${ slug }"]` );
27+
const form = item?.querySelector( 'form' );
2728
if ( ! form ) {
2829
return;
2930
}

projects/plugins/jetpack/_inc/content-guidelines-ai/style.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,10 @@ $cg-diff-removed: #f8d7da;
110110
}
111111

112112
// Badge in accordion headers.
113-
// Hide badge when accordion is expanded — the Accept/Dismiss
114-
// buttons inside already communicate the suggestion state.
115-
// stylelint-disable-next-line selector-max-compound-selectors
116-
.content-guidelines__accordion-trigger[aria-expanded="true"]
117-
.jetpack-content-guidelines-ai__badge-container {
113+
// Hide badge when the accordion is expanded — the Accept/Dismiss
114+
// buttons inside already communicate the suggestion state. The badge is
115+
// injected inside the CollapsibleCard trigger, which carries aria-expanded.
116+
[aria-expanded="true"] .jetpack-content-guidelines-ai__badge-container {
118117
display: none;
119118
}
120119

0 commit comments

Comments
 (0)