From 9c5dd6d52ce584ad12cc007ea39a6c0f22f8e340 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 15 Oct 2026 14:16:11 +0400 Subject: [PATCH] Notes: Drop misleading aria-haspopup from Add note menu item Also select only needed block data. Co-Authored-By: Claude Opus 5.5 --- packages/editor/CHANGELOG.md | 1 + .../collab-sidebar/add-note-menu-item.jsx | 28 ++++++++----------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/packages/editor/CHANGELOG.md b/packages/editor/CHANGELOG.md index 8bbe3df5a4d389..8ad3e3bcee24e3 100644 --- a/packages/editor/CHANGELOG.md +++ b/packages/editor/CHANGELOG.md @@ -18,6 +18,7 @@ - Notes: Highlight the text an unsent note is about, and keep the note anchored to it when the selection changes or the text is edited before the note is sent ([#84125](https://github.com/WordPress/gutenberg/pull/84125)). - Notes: Select the note under the caret: an inline note while the caret is inside its highlight, otherwise the block's unsent draft or block-level note, instead of an inline note on any click in the block ([#84147](https://github.com/WordPress/gutenberg/pull/84147)). - Visual History: Render the inline removed-text diff (``) at the theme's body color over a red-tinted background instead of recoloring it with a translucent color-matrix filter, so it keeps the theme's WCAG AA contrast on any background ([#82258](https://github.com/WordPress/gutenberg/pull/82258)). +- Notes: Stop announcing the "Add note" block menu item as opening a dialog ([#84818](https://github.com/WordPress/gutenberg/pull/84818)). ### Internal diff --git a/packages/editor/src/components/collab-sidebar/add-note-menu-item.jsx b/packages/editor/src/components/collab-sidebar/add-note-menu-item.jsx index f65c8175137f37..1db3b5a4dfefae 100644 --- a/packages/editor/src/components/collab-sidebar/add-note-menu-item.jsx +++ b/packages/editor/src/components/collab-sidebar/add-note-menu-item.jsx @@ -12,41 +12,37 @@ import { unlock } from '../../lock-unlock'; const { NoteIconSlotFill } = unlock( blockEditorPrivateApis ); function NoteMenuItem( { clientId, onClick, isDistractionFree } ) { - const block = useSelect( + const { blockName, isValid, shortcut } = useSelect( ( select ) => { - return select( blockEditorStore ).getBlock( clientId ); + const { getBlockName, isBlockValid } = select( blockEditorStore ); + return { + blockName: getBlockName( clientId ), + isValid: isBlockValid( clientId ), + shortcut: select( + keyboardShortcutsStore + ).getShortcutRepresentation( 'core/editor/new-note' ), + }; }, [ clientId ] ); - const shortcut = useSelect( - ( select ) => - select( keyboardShortcutsStore ).getShortcutRepresentation( - 'core/editor/new-note' - ), - [] - ); - if ( - ! block?.isValid || - block?.name === getUnregisteredTypeHandlerName() - ) { + if ( ! isValid || blockName === getUnregisteredTypeHandlerName() ) { return null; } - const isDisabled = isDistractionFree || block?.name === 'core/freeform'; + const isDisabled = isDistractionFree || blockName === 'core/freeform'; let infoText; if ( isDistractionFree ) { infoText = __( 'Notes are disabled in distraction free mode.' ); - } else if ( block?.name === 'core/freeform' ) { + } else if ( blockName === 'core/freeform' ) { infoText = __( 'Convert to blocks to add notes.' ); } return (