HTML5's hidden attribute is perfectly suitable for hiding elements that are made invisible by states.js based on #states.

When specified on an element, it indicates that the element is not yet, or is no longer, relevant. User agents should not render elements that have the hidden attribute specified.


casey’s picture

This attribute is supported by all browsers but IE. We can however easily fix it for IE using some CSS

*[hidden] {
  display: none;
Jacine’s picture

theborg’s picture

@jacine thanks!

Just note that we should be aware of:

The hidden attribute must not be used to hide content that could legitimately be shown in another presentation. For example, it is incorrect to use hidden to hide panels in a tabbed dialog, because the tabbed interface is merely a kind of overflow presentation

nod_’s picture

Component:base system» javascript

#states is JS

nod_’s picture

Issue tags:-html5


nod_’s picture

Version:8.0.x-dev» 8.1.x-dev
Category:Feature request» Task
Issue summary:View changes
Issue tags:+JavaScript, +CSS

Still relevant.

Version:8.1.x-dev» 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.