You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Global attributes are those that are present on all HTML elements. Some examples include tabindex and role. A custom element may wish to set its initial tabindex to 0 so it will be keyboard focusable. But you should always check first to see if the developer using your element has set this to another value. If, for example, they've set tabindex to -1, it's a signal that they don't wish for the element to be interactive.
Ensure that there is a check for the attribute before altering (set/remove) the attribute in the connectedCallback.
if (!this.hasAttribute('foo')) this.setAttribute('foo', 'bar')
Ensure that there is a check for the attribute before altering (set/remove) the attribute in the
connectedCallback
.Resource:
https://developers.google.com/web/fundamentals/web-components/best-practices#do-not-override-author-set-global-attributes
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
The text was updated successfully, but these errors were encountered: