Remove role attribute when set to null in data-wp-bind#54608
Merged
SantosGuillamot merged 7 commits intotrunkfrom Sep 20, 2023
Merged
Remove role attribute when set to null in data-wp-bind#54608SantosGuillamot merged 7 commits intotrunkfrom
role attribute when set to null in data-wp-bind#54608SantosGuillamot merged 7 commits intotrunkfrom
Conversation
Member
|
Oh, can you include an entry in the changelog? Thanks! |
|
Size Change: +58 B (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
Contributor
Author
Sure! I just did it. |
Contributor
Author
|
Merging this PR now to ensure it is included in the next release. If there is something else missing we can always include it in a future patch. |
Member
|
The Preact team released v10.18.0, which includes a fix for this: https://github.com/preactjs/preact/releases/tag/10.18.0 I've added it to the roadmap so we don't forget to make this change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
In this pull request I'm adding a workaround to handle the
roleattribute properly until it is solved in Preact. Basically, when we pass anullvalue torole, it is using and empty string instead of removing the HTML element. I submitted this issue to Preact repo.As part of this, I also removed the Server Side Rendering attributes to fix the issue reported here. After this fix it seems that the
aria-modalandroleattributes are properly removed in the Server Side Rendering and after opening and closing the menu.I didn't add logic to remove the
aria-labelbecause it was there before adding the Interactivity API, and some users may be using that. Additionally, as reported in the issue, it shouldn't affect the accessibility.Why?
Right now, there is no way to remove the
roleattribute dynamically, which ends up in an empty value, which is not valid HTML.How?
I added a workaround to handle the
roleattribute until the issue in Preact is solved. Additionally, I removed the attributes for the Server Side Rendering.Testing Instructions
divelement with classwp-block-navigation__responsive-dialogdoesn't havearia-modalorroleattributes.divhasaria-modal="true"androle="dialog".