- Issue created by @finnsky
- Status changed to Needs review
about 1 year ago 1:26pm 18 November 2023 - 🇪🇸Spain ckrina Barcelona
I acknowledge the problem (CSS leaking from other themes), but I’m not sure if everything here is the right solution. There are some things I wouldn’t do, like defining all sizes and fonts in px. I need to invest some time on reviewing it properly and finding alternatives, but I wonder if this should go beyond the CSS itself and should get into the libraries reuse. I'll leave this as NR so other people have the chance to jump in and share their thoughts.
- 🇷🇸Serbia finnsky
we may also define it as rem based but with own variable
using css min https://developer.mozilla.org/en-US/docs/Web/CSS/min```
:root {
--admin-toolbar-rem: min(1rem, 16px);...
--admin-toolbar-space-xl: var(--space-xl, calc(2 * var(--admin-toolbar-rem)));
}this is how we can still use rem and be secured in themes where root font size is 10px
- 🇪🇸Spain ckrina Barcelona
As discussed in Slack we can't reset things in root like this because it would mess up with front-end styles. A potential solution would be to use a generic admin class like
.drupal-admin
and reset styles only there. We need to find a way to ensure specificity here though. - 🇷🇸Serbia finnsky
Yes, this is exactly what i did here.
https://git.drupalcode.org/project/navigation/-/merge_requests/129/diffs...This reset not for root but for special data attribute. which reset styles only in sidebar.
- 🇷🇸Serbia finnsky
```
[data-admin-ui-initial-styles] {
--admin-toolbar-rem: min(1rem, 16px);...
--admin-toolbar-space-xl: var(--space-xl, calc(2 * var(--admin-toolbar-rem)));
}
``` - Status changed to Needs work
12 months ago 3:38pm 24 November 2023 - 🇺🇸United States mherchel Gainesville, FL, US
Thanks for all the work on this! @ckrina and I briefly look at this on a call, and then I dove deeper into it today and left a couple comments.
The main points are
- We cannot use pixels as units. This is an accessibility requirement to pass the core accessibility gate. I understand that themes might set different root font sizes, but if we determine that's problematic (I personally think that's a problem for that theme), we can switch to use EMs at a different point.
- We should emulate the reset at https://git.drupalcode.org/project/drupal/-/blob/10.1.x/core/misc/dialog.... This is well tested and should use
revert
instead of theinitial
property. - Talking with @ckrina yesterday, she was wanting to make more generic reset that could also be used on the toolbar. Assuming we go that route we should do something like this:
.drupal-admin-styles:is(*, #reset) *:where(:not(svg, svg *)) { all: revert; box-sizing: border-box; -webkit-font-smoothing: antialiased; line-height: 1.4; &::after, &::before { all: revert; box-sizing: border-box; -webkit-font-smoothing: antialiased; } }
in the example above the
:is(*, #reset)
adds extra specificity equal to the strongest selector in the:is()
pseudo-class, which in this case is is an ID. So the selector will match the.drupal-admin-styles
class, but have the specificity of an ID.
- 🇷🇸Serbia finnsky
I see a lot of maybe outdated technics but still usable in web:
- Status changed to Needs review
9 months ago 9:13am 14 February 2024 - 🇷🇸Serbia finnsky
@mherchel @ckrina
Hello!
Please take a look at ^ #12
1. For test you can install Umami. and set its base font size 10px;
html { font-size: 62.5%; }
Now we sure that mix font size will be always 16px min. And never 10. So we will not get 7.5px size for links.
2. Added revert approach from linked MR
3. Keeped postcss pix to rem. but we don't need it basically now.
4. Grouped border-box cleanup in single place.
Please review.
- Status changed to Needs work
9 months ago 4:10pm 15 February 2024 - 🇺🇸United States bnjmnm Ann Arbor, MI
+1 to the points brought up in #10.
Not using px prevents a11y breaks. I confirmed the current MR still allows resizing fonts via browser settings and custon stylesheets. These were the two accessibility risks that came to mind and neither appear to be a problem.
I also agree that issues such as the one in Bootstrap are the responsibility of the theme, but I highly recommend offering an MR to popular themes that resize the nav text to unusable sizes. Why require several theme maintainers to figure out a problem that several people in this issue alone would already know how to address.
- 🇷🇸Serbia finnsky
@bnjmnm thank you for review.
In exact this Bootstrap theme OOB is CDN:
https://git.drupalcode.org/project/bootstrap/-/blob/8.x-3.x/src/Plugin/S...Idk how MR will help there
- 🇷🇸Serbia finnsky
All what we can do at the moment ;)
https://www.drupal.org/project/bootstrap/issues/3422731 ✨ EOL Bootstrap 3 message Active - 🇮🇳India Mithun S Bangalore
Mithun S → made their first commit to this issue’s fork.
- 🇮🇳India Mithun S Bangalore
Addressed one of the review comments on the PR and pushed a commit for the same. Thank you!
- First commit to issue fork.
- 🇪🇸Spain ckrina Barcelona
And instead of .drupal-admin-styles, it would be the [data-drupal-admin-styles] attribute, correct?
Exactly :)
About the
#reset
code @mherchel used, I'm not sure what he meant. So not sure about using#admin-toolbar
because several totally independent admin elements will be added, unless it's on a really top level. - Status changed to Needs review
9 months ago 10:23pm 6 March 2024 - 🇺🇸United States starshaped
Pushed some changes to rename the selector and cleaned up the specificity of the selector after renaming. Let me know if this is the right way to approach the selector, @mherchel / @ckrina!
- Status changed to Needs work
9 months ago 7:04am 7 March 2024 - Status changed to Needs review
9 months ago 5:59pm 7 March 2024 - 🇺🇸United States starshaped
@finnsky Thanks for the review and for pointing out that the resets were resetting more than just the sidebar. I updated it to follow what you posted in the MR so take a look again. I checked it in Bootstrap, Umami, and Olivero and the resets are now staying in the admin toolbar.
- Status changed to RTBC
9 months ago 6:50pm 7 March 2024 - Status changed to Fixed
9 months ago 9:48am 11 March 2024 Automatically closed - issue fixed for 2 weeks with no activity.