3 ms·
This would be way more helpful if browsers all supported extending built-in elements and inheriting accessibility features. For example, if `class DropdownMenu
by _heimdall 2y ago
This would be way more helpful if browsers all supported extending built-in elements and inheriting accessibility features.
For example, if `class DropdownMenu extends HTMLSelectElement` worked, you could have full control of styling and functionality without having to recreate all the a11y support baked into `<select>`. As it stands today, this will be treated as a div and its all on you to make it accessible.
- Joeri 2y agoSafari (Webkit) is the hold-out on having this: https://caniuse.com/mdn-api_customelementregistry_builtin_element_support https://caniuse.com/mdn-api_customelementregistry_builtin_el... The reasoning for choosing not to support it is here: https://github.com/WebKit/standards-positions/issues/97#issuecomment-1328880274 https://github.com/WebKit/standards-positions/issues/97#issu...
- _heimdall 2y agoThanks! I was pretty sure Safari was the only major holdout but didn't have a link handy and didn't want to speak out of turn there. That kind of support is a really tough one to work around with a major browser lacking support. For certain features its not a big deal, but when it comes to extending to get full accessibility support the only substitute is avoiding the feature and rolling it all custom. It really is a shame in my opinion, extending built-ins is extremely powerful.
- extra88 2y agoBlame Safari. The standard includes the `is` attribute, it's supported by all browsers except Safari, but Safari not only hasn't worked on supporting it, they've stated they won't do so. https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/is https://developer.mozilla.org/en-US/docs/Web/HTML/Global_att...