Skip to content

Conversation

@dhruvang21
Copy link
Contributor

What?

Closes #72824

Why?

When working in Distraction-Free Mode, the Add Notes option in the Block Toolbar does not display the New Note form or trigger any visible action.

How?

Visually hide the Add note button

Testing Instructions

  1. Open a post or page.
  2. Switch to distraction free mode.

Screenshots or screencast

Pages.gutenberg.WordPress.mp4

@github-actions
Copy link

github-actions bot commented Oct 30, 2025

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: dhruvang21 <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: jeffpaul <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: adamsilverstein <[email protected]>
Co-authored-by: karthick-murugan <[email protected]>

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

@t-hamano t-hamano 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
@github-project-automation github-project-automation bot moved this to 🔎 Needs Review in WordPress 6.9 Editor Tasks Oct 31, 2025
@jeffpaul
Copy link
Member

@dhruvang21 looks like a merge conflict, if you could take a look and resolve that would be lovely, thanks!

@dhruvang21
Copy link
Contributor Author

@jeffpaul Rebased

Copy link
Contributor

@t-hamano t-hamano 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 PR!

In the Distraction Free mode, the NoteSidebar itself component doesn't need to render anything at all. Therefore, this should be handled in the parent NotesSidebarContainer component, like this:

export default function NotesSidebarContainer() {
	const { postId, mode, editorMode, isDistractionFree } = useSelect(
		( select ) => {
			const { getCurrentPostId, getRenderingMode, getEditorMode } =
				select( editorStore );
			const { getSettings } = select( blockEditorStore );
			return {
				postId: getCurrentPostId(),
				mode: getRenderingMode(),
				editorMode: getEditorMode(),
				isDistractionFree: getSettings().isDistractionFree,
			};
		},
		[]
	);

	if ( ! postId || typeof postId !== 'number' || isDistractionFree ) {
		return null;
	}

	// Hide Notes sidebar in Code Editor mode since block-level commenting.
	if ( editorMode === 'text' ) {
		return null;
	}

	return (
		<PostTypeSupportCheck supportKeys="editor.notes">
			<NotesSidebar postId={ postId } mode={ mode } />
		</PostTypeSupportCheck>
	);
}

@jeffpaul jeffpaul moved this from 🔎 Needs Review to 🏗️ In Progress in WordPress 6.9 Editor Tasks Nov 3, 2025
@dhruvang21
Copy link
Contributor Author

@t-hamano updated code as per your suggestion

@t-hamano
Copy link
Contributor

t-hamano commented Nov 3, 2025

@dhruvang21 Can you remove the isDistractionFree check from the NotesSidebar component? These checks are no longer necessary.

@dhruvang21
Copy link
Contributor Author

@t-hamano Done

@t-hamano t-hamano 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 Nov 3, 2025
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@t-hamano t-hamano merged commit a2f779c into WordPress:trunk Nov 3, 2025
37 of 38 checks passed
@github-project-automation github-project-automation bot moved this from 🏗️ In Progress to ✅ Done in WordPress 6.9 Editor Tasks Nov 3, 2025
@github-actions github-actions bot added this to the Gutenberg 22.1 milestone Nov 3, 2025
gutenbergplugin pushed a commit that referenced this pull request Nov 3, 2025
* Hide add note in distraction free mode

* refactor: NotesSidebarContainer component code

* refactor: remove condition from NotesSidebar component

Co-authored-by: dhruvang21 <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: jeffpaul <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: adamsilverstein <[email protected]>
Co-authored-by: karthick-murugan <[email protected]>
@github-actions github-actions bot added Backported to WP Core Pull request that has been successfully merged into WP Core and removed Backport to WP 6.9 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Nov 3, 2025
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

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

t-hamano added a commit that referenced this pull request Nov 4, 2025
t-hamano added a commit that referenced this pull request Nov 4, 2025
* Revert "Hide add note in distraction free mode (#72835)"

This reverts commit a2f779c.

* Notes: Disable "Add note" button in Distraction free mode

Co-authored-by: t-hamano <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: jeffpaul <[email protected]>
gutenbergplugin pushed a commit that referenced this pull request Nov 4, 2025
* Revert "Hide add note in distraction free mode (#72835)"

This reverts commit a2f779c.

* Notes: Disable "Add note" button in Distraction free mode

Co-authored-by: t-hamano <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: jeffpaul <[email protected]>
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

Development

Successfully merging this pull request may close these issues.

Add Notes option not working in Distraction-Free Mode

3 participants