-
Notifications
You must be signed in to change notification settings - Fork 11
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
auro-button: cannot call document.createElement when focus visible polyfill applied to shadow root #112
Comments
@geoffrich I am wondering if this nested support of focus-visible and the polyfill is even worth the trouble? I mean, there is a $30k bounty to get it done. If I understand this correctly, this is an issue where the button is installed into another CE as a dependency? I am only coming up with examples where the button is content and there are no issues there. The bug you made doesn't reference a CE and the codePen doesn't appear to be working? But, if we remove this feature from the Other than Safari, everywhere else this works. When it comes to Safari, the majority of its users are on iOS and that has a completely different experience when it comes to a11y. Then there is the :-webkit-direct-focus. How that will play into things? And I am coming to the conclusion that this should be closed without merge. |
Correct, this is only an issue when the button is being used in another CE's shadow DOM. I've fixed the CodePen you linked to show the original issue by pinning to the previous version of the button. This is not a niche use case -- the component hangar uses Auro elements like this in many of its components.
Currently if we remove this feature from the button, focus styles will break in Safari when the button is inside another shadow DOM. I am not comfortable excluding Safari users from seeing focus outlines if their browser does not support focus-visible. Sure, desktop Safari has less usage compared to other browsers, but they should still have an accessible experience. I am more comfortable with the failure case of a guest seeing focus styles when they don't need to see them instead of not seeing focus styles when they need them. The former damages aesthetics, while the latter damages accessibility. The goal here is for everyone to see focus outlines if they require them. I see two options:
I think the latter is where we need to move to deprecate the focus-visible polyfill support as soon as possible. We could do that work as part of this issue and remove the polyfill from auro-button entirely. What do you think? |
Sent meeting invite to review options. |
Meeting outcome: will go ahead with the quick fix of moving the polyfill to connectedCallback and revisit polyfill support at later date. Nesting Auro components is a significant use case due to the component hangar. |
## [6.3.1](v6.3.0...v6.3.1) (2021-05-24) ### Bug Fixes * prevent errors with createElement [#112](#112) ([4c49880](4c49880))
🎉 This issue has been resolved in version 6.3.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Describe the bug
Calling
document.createElement('auro-button')
throws the following exception:This only happens when the focus-visible polyfill is applied to the shadow root in the button's constructor.
I don't think this has caused any real-world impact. However, it did break tests (#110) and clutters up the console.
To Reproduce
Steps to reproduce the behavior:
document.createElement('auro-button')
. See the error get thrown.Expected behavior
No exception is thrown
Desktop (please complete the following information):
Additional context
This happens because loading the polyfill in the constructor applies an attribute to the element, and this is a violation of the spec for custom element constructors:
I think we need to move the polyfill loading to connectedCallback instead.
The text was updated successfully, but these errors were encountered: