Skip to content

Conversation

@karthick-murugan
Copy link
Contributor

@karthick-murugan karthick-murugan commented Oct 31, 2025

What?

Closes #72828

Hides the Notes sidebar and the Notes option from the Options menu when the editor is in Code Editor mode, as block-level commenting is not applicable without visual block rendering.

Why?

Currently, when switching to Code Editor mode, the Notes sidebar remains visible. This creates confusion and functional limitations:

  • It's unclear which block the notes are associated with, since the visual block structure is not available in Code Editor view
  • The "Add Notes" button is missing because the Block Toolbar is not accessible in this mode
  • Users are unable to add new notes or clearly identify the block context of existing notes

Block-level commenting requires visual blocks to function properly, so the Notes sidebar should be hidden when in Code Editor mode.

How?

  1. Added useSelect hook to detect the current editor mode using getEditorMode() from editorStore
  2. Check if editorMode === 'text'
  3. Return null early when in Code Editor mode, which hides Notes

Testing Instructions

  1. Open a post or page in the editor
  2. Add a few blocks and optionally add Notes to some blocks
  3. Verify the Notes sidebar is visible and functional in Visual Editor mode
  4. Switch to Code Editor mode (via the editor mode switcher or keyboard shortcut)
  5. Notes feature disabled from the Options menu, and the Notes sidebar is also deactivated.
  6. Switch back to Visual Editor mode
  7. Verify that the Notes sidebar reappears and functions normally

Video

REC-20251031112743.mp4

@karthick-murugan karthick-murugan marked this pull request as ready for review October 31, 2025 06:08
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: karthick-murugan <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: jeffpaul <[email protected]>
Co-authored-by: desrosj <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka
Copy link
Member

I think the logic should go in the NotesSidebarContainer component. We're already selecting data from editorStore, and it also handles early bailouts.

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Feature] Notes Phase 3 of the Gutenberg roadmap around block commenting labels Oct 31, 2025
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow-up, @karthick-murugan!

This is working as expected.

@Mamaduka Mamaduka added the Backport to WP 6.9 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Oct 31, 2025
@Mamaduka Mamaduka merged commit 3d72265 into WordPress:trunk Oct 31, 2025
37 checks passed
@github-actions github-actions bot added this to the Gutenberg 22.1 milestone Oct 31, 2025
@github-actions github-actions bot removed the Backport to WP 6.9 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Oct 31, 2025
gutenbergplugin pushed a commit that referenced this pull request Oct 31, 2025
Co-authored-by: karthick-murugan <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: jeffpaul <[email protected]>
Co-authored-by: desrosj <[email protected]>
@github-actions github-actions bot added the Backported to WP Core Pull request that has been successfully merged into WP Core label Oct 31, 2025
@github-actions
Copy link

I just cherry-picked this PR to the wp/6.9 branch to get it included in the next release: f7bd86b

@karthick-murugan karthick-murugan deleted the code-editor-notes-disable branch October 31, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backported to WP Core Pull request that has been successfully merged into WP Core [Feature] Notes Phase 3 of the Gutenberg roadmap around block commenting [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notes sidebar persists in Code Editor mode but lacks block reference

2 participants