Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/editor/src/components/collab-sidebar/add-note.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ export function AddNote( { onSubmit, sidebarRef, floating } ) {
}
} }
onCancel={ unselectNote }
labels={ { input: __( 'New note' ) } }
labels={ {
input: __( 'New note' ),
placeholder: __( 'Add a note or @ mention' ),
} }
/>
</NoteCard>
</FloatingContainer>
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/components/collab-sidebar/note-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export function NoteForm( { onSubmit, onCancel, note, labels } ) {
hideLabelFromVision
value={ inputComment }
onChange={ setInputComment }
placeholder={ labels?.placeholder }
allowedFormats={ ALLOWED_NOTE_FORMATS }
completers={ NOTE_COMPLETERS }
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ export function NoteThread( {
note.id,
note.author_name
),
placeholder: __( 'Reply or @ mention' ),
} }
/>
</NoteCard>
Expand Down
49 changes: 0 additions & 49 deletions test/e2e/specs/editor/various/block-notes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1783,55 +1783,6 @@ test.describe( 'Block Notes', () => {
await expect( replyTextbox ).toBeVisible();
} );

test( 'does not render the hidden field label as a placeholder', async ( {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removing this test; it was testing RichTextControl implementation details and isn't needed.

editor,
page,
blockNoteUtils,
} ) => {
/*
* The note forms label their fields with a visually hidden
* label ("New note" / "Reply to note N by author") and render
* no placeholder; the rich text placeholder element only
* mounts when a placeholder is passed, so its presence means
* the hidden label leaked into the visible field.
*/
await editor.insertBlock( {
name: 'core/paragraph',
attributes: { content: 'Placeholder host' },
} );
await editor.clickBlockOptionsMenuItem( 'Add note' );
const newNoteTextbox = page.getByRole( 'textbox', {
name: 'New note',
exact: true,
} );
await expect( newNoteTextbox ).toBeVisible();
await expect( newNoteTextbox ).not.toHaveAttribute(
'aria-placeholder',
/./
);
await expect(
newNoteTextbox.locator( '[data-rich-text-placeholder]' )
).toHaveCount( 0 );

await blockNoteUtils.addNote( 'Placeholder note' );
const replyTextbox = page.getByRole( 'textbox', {
name: 'Reply to',
} );
await expect( replyTextbox ).toBeVisible();
// The visually hidden label still provides the descriptive
// accessible name; only the visible placeholder is gone.
await expect( replyTextbox ).toHaveAccessibleName(
/^Reply to note \d+ by admin$/
);
await expect( replyTextbox ).not.toHaveAttribute(
'aria-placeholder',
/./
);
await expect(
replyTextbox.locator( '[data-rich-text-placeholder]' )
).toHaveCount( 0 );
} );

test( 'backtick wrapping applies core/code inline format', async ( {
editor,
page,
Expand Down
Loading