Skip to content

Commit

Permalink
Use empty string to set boolean attribute
Browse files Browse the repository at this point in the history
This is a minimal way of setting the `hidden` attribute.

From MDN:

> The hidden attribute is used to indicate that the content of an element should not be presented to the user. This attribute can take any one of the following values:
>
> - an empty string
> - the keyword hidden
> - the keyword until-found
>
> An empty string, or the keyword hidden, set the element to the hidden state. Additionally, invalid values set the element to the hidden state.

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden
  • Loading branch information
sirreal committed Sep 17, 2024
1 parent 62ad427 commit ab79786
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/a11y/src/script/add-intro-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function addIntroText() {
'border:0;' +
'word-wrap:normal !important;'
);
introText.setAttribute( 'hidden', 'hidden' );
introText.setAttribute( 'hidden', '' );

const { body } = document;
if ( body ) {
Expand Down

0 comments on commit ab79786

Please sign in to comment.