Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Editor: Remove aria-selected from LinkPreview #43279

Merged
merged 2 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default function LinkPreview( {
'is-preview': true,
'is-error': isEmptyURL,
} ) }
role="option"
Copy link
Member

Choose a reason for hiding this comment

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

I'm not exactly sure what's going on in this part of the component, because <LinkPreview> never seems to be contained in a listbox. Could it be the aria-selected part that's unnecessary, perhaps?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call. I've taken a look at the component in action and it doesn't seem to behave as an option in a listbox either.

I've removed the role and the aria-selected as you suggested and fixed the test in c14c0c6.

Feel free to take another look when you get a chance.

>
<div className="block-editor-link-control__search-item-top">
<span className="block-editor-link-control__search-item-header">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ describe( 'Basic rendering', () => {
/>
);

const linkPreview = screen.queryByRole( 'generic', {
name: 'Currently selected',
const linkPreview = screen.queryByRole( 'option', {
selected: true,
} );

const isPreviewError = linkPreview.classList.contains( 'is-error' );
Expand Down