Problem/Motivation

Split from #3512262: Move details.module.css to the collapse library.

This has only one line of CSS, which hasn't been updated since at least 2015.

I couldn't see any difference with or with out it. Asked in slack and got this detailed reply from @jacine.

I think this is related to a Safari bug (which may be fixed by now dunno)? IIRC the problem is accessibility related, and the contents of closed details elements were fully accessible via keyboard, which should not be the case. To test you would need:
A page that renders a closed details element with a focusable element inside the content, like a link (or form element).
In Safari (I think), navigate the page using keyboard only.
Expected result is that the link in the closed details element is not focused (you can't see it anyway, so you'd be tabbing to what visually seems like nowhere).
Actual result (what that CSS fixes) is the link is focusable

We should check if safari still has the bug, and if not, I think we could remove the file.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3512284

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

catch created an issue. See original summary.

catch credited jacine.

catch’s picture

feuerwagen’s picture

Status: Active » Needs review

I can not reproduce this issue:

- Using Safari 18.3 on mac OS 15.3.1, full keyboard access active (otherwise Safari won't tab focus links at all)
- Codepen with three details elements, each with a paragraph of text and one with an additional link inside
- all collapsed: tab just highlights the three summaries, no additional invisible focus in between
- with the details with the link expanded: tab highlights the three summaries and also the link in between

Not sure when it got fixed though.

catch’s picture

Issue tags: -Needs manual testing

So the CSS was preserved in 2013 when details support was added. There is no reference to why it was preserved, but not all browsers supported details at that point so we didn't even use the proper html5 element for it yet, was a JavaScript quasi-polyfill instead with a @todo to add a real html5 polyfill later.

This is the diff that preserved it:

--- a/core/modules/system/system.base.css
+++ b/core/modules/system/system.base.css
@@ -38,25 +38,13 @@
 }
 
 /**
- * Collapsible fieldsets.
+ * Collapsible details.
  *
  * @see collapse.js
  */
-.js fieldset.collapsed {
-  border-bottom-width: 0;
-  border-left-width: 0;
-  border-right-width: 0;
-  height: 1em;
-}
-.js fieldset.collapsed .fieldset-wrapper {
+.js details:not([open]) .details-wrapper {
   display: none;
 }

That issue doesn't mention any safari accessibility bugs, and I just noticed now that the css uses the .js class which means it was specifically for the js implementation of details (not the browser-native one that came later).

Given all that and the testing from @feuerwagen I think it's safe to drop.

catch’s picture

Title: Check if we still need details.css » Remove details.css since it is no longer needed
Issue tags: +frontend performance, +CSS

Postponed #3512262: Move details.module.css to the collapse library on this issue and put up an MR.

While this is a tiny amount of CSS, we duplicate individual CSS files quite a lot in aggregates still even after recent improvements, so files in the system/base library can end up getting downloaded multiple times by the same visitor from different pages. Also in situations like the installer where there's no aggregation, it's one less http request.

smustgrave’s picture

Status: Needs review » Needs work

Seemed to cause a number of test failures.

catch’s picture

Status: Needs work » Needs review

Could only see one known random failure, but did a rebase anyway.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Yea not sure what was happening when I looked but all seems good now.

  • nod_ committed 365250d1 on 11.x
    Issue #3512284 by catch, jacine, feuerwagen: Remove details.css since it...
nod_’s picture

Status: Reviewed & tested by the community » Fixed

Committed 365250d and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.