When a path is initially navigated that utilizes a table filter (like the modules or permissions pages). The page is initially viewable without the table filter. Then the JavaScript kicks in and modifies the DOM so that the page layout shifts as the table filter appears.
This issue is intended to mitigate or remove this jankiness (as much as possible).
Plan
The plan is to use the new at-media scripting feature to reduce the jank as much as possible in browsers that support this. For older browsers, the current behavior will still persist.
Testing
Note that the at-media feature is not supported in the latest version of Chrome (119). It is supported in the next version of Chrome (120), Safari 17, and Firefox. So, if you're testing on Chrome, please verify that you're on 120 or later (you can use Chrome Canary if you'd like).
- Navigate to the page in question (in this case /admin/modules), and open developer tools. Go to the network tab and set throttling to "Fast 3G") and ensure that "Disable cache" is checked.
- Reload the browser and notice how the "filter" pops in and shifts the layout.
- Apply the patch.
- Test again and note how the "filter" is there on page load and does not "pop in".
- Test the page without JavaScript (you can disable this in dev tools)
- Test the page on an older browser that doesn't support this new feature. The behavior should not change.
- Test the page on other browsers to ensure it works as expected.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3404218.patch | 591 bytes | mherchel |
| table-filter.mp4 | 1.83 MB | mherchel |
Issue fork drupal-3404218
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:
- 3404218-table-filter-creates
changes, plain diff MR !5587
Comments
Comment #2
mherchelComment #3
smustgrave commented@mherchel is there an additional step? I'm on Version 119.0.6045.159 (Official Build) (arm64) and applying the patch I'm not noticing any difference on the page load
Comment #4
smustgrave commentedComment #5
mherchelHa! You're just like me and skipped over part of the testing steps (I do this all the time). Here's the part that you missed 🤣🤣🤣
Comment #6
smustgrave commentedTested on firefox and see what you mean now.
Wonder if a meta should be opened for other locations this could be used?
Comment #7
mherchelGreat minds think alike :D
#3404214: META: Reduce / eliminate “jank” (layout shifts) within Drupal’s admin UI
Comment #8
lauriiiWhy not
.js-hide.js-hidelike we do usually when we need to increase specificity?Shouldn't we add the extra specificity here too?
Comment #11
djsagar commentedHI lauriii,
I tried to changes as per your comment, kindly review.
Thanks!
Comment #12
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue.
While you are making the above changes, we recommend that you convert this patch to a merge request. Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)
Comment #13
djsagar commentedComment #14
mherchelNo specific reason. Attribute has the same specificity as a class, so 🤷♂️. Not sure if there's a preference.
Nope. We don't need it. The extra specificity is only for when JS is enabled, and therefore the current (previous) ruleset works file. We only need to take into account for situations where JavaScript is enabled but the
.jsclass is not yet present.Comment #15
lauriiiAh, you're right @mherchel! I fixed it.
Comment #16
smustgrave commentedRestoring status.
Comment #17
johnpitcairn commentedSafari 17 is quite a high bar given Apple ties it to specific OS updates (it's the new IE). Any interest in a fallback technique with broader browser support?
Comment #21
lauriiiNot sure it's worth using too much time trying to invent another solution for this since it's a perceived performance improvement for a problem that has existed for years in Drupal. If you are interested in that and want to propose something, I think it would be fine to do so in the meta issue.
Committed 3ad9ff9 and pushed to 11.x. Also cherry-picked to 10.2.x. Thanks!
Comment #22
johnpitcairn commentedFair enough. No on second thought it's a problem that will go away eventually by itself with these fixes in.
Comment #24
catchFollow-up #3514748: Remove legacy browser support from js.module.css.