Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(accordion): hover colors #2068

Merged
merged 12 commits into from
Dec 9, 2024
Merged

fix(accordion): hover colors #2068

merged 12 commits into from
Dec 9, 2024

Conversation

bennypowers
Copy link
Member

Closes #2065

What I did

  1. restore hover colors for accordion headings
  2. remove unnecessary wrapping div

Testing Instructions

  1. view accordion demo in dev server on light and dark backgrounds

Copy link

changeset-bot bot commented Nov 26, 2024

🦋 Changeset detected

Latest commit: 3d3f330

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@rhds/elements Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

netlify bot commented Nov 26, 2024

Deploy Preview for red-hat-design-system ready!

Name Link
🔨 Latest commit 8ec2cc4
🔍 Latest deploy log https://app.netlify.com/sites/red-hat-design-system/deploys/6756cd14cfcfd40008d48607
😎 Deploy Preview https://deploy-preview-2068--red-hat-design-system.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented Nov 26, 2024

Size Change: +38 B (+0.02%)

Total Size: 207 kB

Filename Size Change
./elements/rh-accordion/rh-accordion-header.js 2.75 kB -16 B (-0.58%)
./elements/rh-accordion/rh-accordion-panel.js 1.35 kB -13 B (-0.95%)
./elements/rh-accordion/rh-accordion.js 3.21 kB +7 B (+0.22%)
./lib/context/color/consumer.js 1.41 kB +61 B (+4.53%) 🔍
./lib/context/color/provider.js 2.18 kB -1 B (-0.05%)
ℹ️ View Unchanged
Filename Size
./elements.js 473 B
./elements/rh-accordion/context.js 162 B
./elements/rh-alert/rh-alert.js 4.31 kB
./elements/rh-audio-player/rh-audio-player-about.js 1.85 kB
./elements/rh-audio-player/rh-audio-player-rate-stepper.js 1.85 kB
./elements/rh-audio-player/rh-audio-player-scrolling-text-overflow.js 1.53 kB
./elements/rh-audio-player/rh-audio-player-subscribe.js 1.43 kB
./elements/rh-audio-player/rh-audio-player.js 13.2 kB
./elements/rh-audio-player/rh-cue.js 2 kB
./elements/rh-audio-player/rh-transcript.js 2.75 kB
./elements/rh-avatar/random-pattern-controller.js 2.72 kB
./elements/rh-avatar/rh-avatar.js 2.9 kB
./elements/rh-back-to-top/rh-back-to-top.js 2.1 kB
./elements/rh-badge/rh-badge.js 1.55 kB
./elements/rh-blockquote/rh-blockquote.js 1.41 kB
./elements/rh-breadcrumb/rh-breadcrumb.js 1.5 kB
./elements/rh-button/rh-button.js 4.24 kB
./elements/rh-card/rh-card.js 3.64 kB
./elements/rh-code-block/prism.css.js 822 B
./elements/rh-code-block/prism.js 572 B
./elements/rh-code-block/rh-code-block.js 7.25 kB
./elements/rh-cta/rh-cta.js 3.96 kB
./elements/rh-dialog/rh-dialog.js 4.78 kB
./elements/rh-dialog/yt-api.js 617 B
./elements/rh-footer/rh-footer-block.js 766 B
./elements/rh-footer/rh-footer-copyright.js 362 B
./elements/rh-footer/rh-footer-links.js 1.17 kB
./elements/rh-footer/rh-footer-social-link.js 964 B
./elements/rh-footer/rh-footer-universal.js 4.05 kB
./elements/rh-footer/rh-footer.js 5.01 kB
./elements/rh-health-index/rh-health-index.js 2.35 kB
./elements/rh-icon/rh-icon.js 2.35 kB
./elements/rh-icon/ssr.js 181 B
./elements/rh-menu/rh-menu.js 1.29 kB
./elements/rh-navigation-secondary/rh-navigation-secondary-dropdown.js 2.47 kB
./elements/rh-navigation-secondary/rh-navigation-secondary-menu-section.js 1.35 kB
./elements/rh-navigation-secondary/rh-navigation-secondary-menu.js 1.75 kB
./elements/rh-navigation-secondary/rh-navigation-secondary-overlay.js 571 B
./elements/rh-navigation-secondary/rh-navigation-secondary.js 5.31 kB
./elements/rh-navigation-secondary/test/fixtures.js 769 B
./elements/rh-pagination/rh-pagination.js 5.46 kB
./elements/rh-site-status/rh-site-status.js 2.5 kB
./elements/rh-skip-link/rh-skip-link.js 1.24 kB
./elements/rh-spinner/rh-spinner.js 1.43 kB
./elements/rh-stat/rh-stat.js 2.2 kB
./elements/rh-subnav/rh-subnav.js 2.73 kB
./elements/rh-surface/rh-surface.js 1.11 kB
./elements/rh-surface/test/elements.js 423 B
./elements/rh-switch/rh-switch.js 2.93 kB
./elements/rh-table/rh-sort-button.js 1.49 kB
./elements/rh-table/rh-table.js 3.54 kB
./elements/rh-tabs/context.js 160 B
./elements/rh-tabs/rh-tab-panel.js 1.04 kB
./elements/rh-tabs/rh-tab.js 3.02 kB
./elements/rh-tabs/rh-tabs.js 3.77 kB
./elements/rh-tag/rh-tag.js 2.84 kB
./elements/rh-tile/rh-tile-group.js 1.81 kB
./elements/rh-tile/rh-tile.js 5.15 kB
./elements/rh-timestamp/rh-timestamp.js 983 B
./elements/rh-tooltip/rh-tooltip.js 2.24 kB
./elements/rh-video-embed/rh-video-embed.js 4.6 kB
./lib/context/color/controller.js 947 B
./lib/context/event.js 593 B
./lib/context/headings/consumer.js 722 B
./lib/context/headings/controller.js 1.12 kB
./lib/context/headings/provider.js 1.24 kB
./lib/DirController.js 565 B
./lib/elements/rh-context-demo/rh-context-demo.js 1.28 kB
./lib/elements/rh-context-picker/rh-context-picker.js 2.24 kB
./lib/environment.js 194 B
./lib/functions.js 175 B
./lib/I18nController.js 1.38 kB
./lib/ScreenSizeController.js 849 B
./lib/ssr-controller.js 251 B
./react/rh-accordion/rh-accordion-header.js 199 B
./react/rh-accordion/rh-accordion-panel.js 185 B
./react/rh-accordion/rh-accordion.js 215 B
./react/rh-alert/rh-alert.js 184 B
./react/rh-audio-player/rh-audio-player-about.js 191 B
./react/rh-audio-player/rh-audio-player-rate-stepper.js 213 B
./react/rh-audio-player/rh-audio-player-scrolling-text-overflow.js 214 B
./react/rh-audio-player/rh-audio-player-subscribe.js 196 B
./react/rh-audio-player/rh-audio-player.js 183 B
./react/rh-audio-player/rh-cue.js 195 B
./react/rh-audio-player/rh-transcript.js 207 B
./react/rh-avatar/rh-avatar.js 173 B
./react/rh-back-to-top/rh-back-to-top.js 183 B
./react/rh-badge/rh-badge.js 174 B
./react/rh-blockquote/rh-blockquote.js 179 B
./react/rh-breadcrumb/rh-breadcrumb.js 179 B
./react/rh-button/rh-button.js 174 B
./react/rh-card/rh-card.js 172 B
./react/rh-code-block/rh-code-block.js 181 B
./react/rh-cta/rh-cta.js 170 B
./react/rh-dialog/rh-dialog.js 203 B
./react/rh-footer/rh-footer-block.js 184 B
./react/rh-footer/rh-footer-copyright.js 187 B
./react/rh-footer/rh-footer-links.js 185 B
./react/rh-footer/rh-footer-social-link.js 193 B
./react/rh-footer/rh-footer-universal.js 188 B
./react/rh-footer/rh-footer.js 174 B
./react/rh-health-index/rh-health-index.js 184 B
./react/rh-icon/rh-icon.js 202 B
./react/rh-menu/rh-menu.js 173 B
./react/rh-navigation-secondary/rh-navigation-secondary-dropdown.js 217 B
./react/rh-navigation-secondary/rh-navigation-secondary-menu-section.js 205 B
./react/rh-navigation-secondary/rh-navigation-secondary-menu.js 199 B
./react/rh-navigation-secondary/rh-navigation-secondary-overlay.js 201 B
./react/rh-navigation-secondary/rh-navigation-secondary.js 213 B
./react/rh-pagination/rh-pagination.js 178 B
./react/rh-site-status/rh-site-status.js 181 B
./react/rh-skip-link/rh-skip-link.js 181 B
./react/rh-spinner/rh-spinner.js 175 B
./react/rh-stat/rh-stat.js 171 B
./react/rh-subnav/rh-subnav.js 175 B
./react/rh-surface/rh-surface.js 175 B
./react/rh-switch/rh-switch.js 185 B
./react/rh-table/rh-sort-button.js 213 B
./react/rh-table/rh-table.js 174 B
./react/rh-tabs/rh-tab-panel.js 181 B
./react/rh-tabs/rh-tab.js 187 B
./react/rh-tabs/rh-tabs.js 174 B
./react/rh-tag/rh-tag.js 182 B
./react/rh-tile/rh-tile-group.js 183 B
./react/rh-tile/rh-tile.js 194 B
./react/rh-timestamp/rh-timestamp.js 176 B
./react/rh-tooltip/rh-tooltip.js 175 B
./react/rh-video-embed/rh-video-embed.js 227 B
./uxdot/uxdot-best-practice.js 742 B
./uxdot/uxdot-copy-button.js 1.2 kB
./uxdot/uxdot-copy-permalink.js 1.1 kB
./uxdot/uxdot-example.js 1.17 kB
./uxdot/uxdot-feedback.js 727 B
./uxdot/uxdot-header.js 1.07 kB
./uxdot/uxdot-hero.js 679 B
./uxdot/uxdot-installation-tabs.js 675 B
./uxdot/uxdot-masthead.js 809 B
./uxdot/uxdot-pattern-ssr-controller-client.js 604 B
./uxdot/uxdot-pattern-ssr-controller-server.js 1.68 kB
./uxdot/uxdot-pattern-ssr-controller.js 213 B
./uxdot/uxdot-pattern.js 2.12 kB
./uxdot/uxdot-repo-status-checklist.js 1.16 kB
./uxdot/uxdot-repo-status-list.js 1.07 kB
./uxdot/uxdot-repo-status-table.js 782 B
./uxdot/uxdot-repo.js 1.17 kB
./uxdot/uxdot-search.js 2.39 kB
./uxdot/uxdot-sidenav.js 2.67 kB
./uxdot/uxdot-spacer-tokens-table.js 2.45 kB
./uxdot/uxdot-toc.js 1.13 kB

compressed-size-action

Copy link
Collaborator

@marionnegp marionnegp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I can see the hover background color in the color context demo, but it's not showing up in any other demo.

  • Did the div that was removed allow the red line to extend to the panel header when it's expanded?

Screenshot 2024-11-26 at 9 23 53 AM
  • On hover, the accordion in dark theme shows black text.
Screenshot 2024-11-26 at 9 28 36 AM

@bennypowers
Copy link
Member Author

looks like maybe some ssr problems

@bennypowers
Copy link
Member Author

@marionnegp PTAL, thanks

@bennypowers bennypowers enabled auto-merge (squash) December 1, 2024 08:18
Copy link
Collaborator

@marionnegp marionnegp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to previous comments look good! I noticed a couple other things that I might have missed last time.

  • When any of the accordion panels are expanded, the last accordion also shows a dropshadow. There shouldn't be a dropshadow on a panel unless it's expanded.
    Screenshot 2024-12-02 at 4 24 07 PM

  • When you first land on the color context demo, the text in an expanded panel is black for the dark theme accordions. I'm able to resolve it by viewing the accordion in a light color palette and then clicking back to a dark color palette, so it might just be a demo error. Noting it in case this confuses UX dot users.
    Screenshot 2024-12-02 at 4 25 05 PM

@bennypowers
Copy link
Member Author

let's do the drop shadow thing in a separate issue - there was confusion about this earlier in the quarter and i want to make sure we're all on the same page

with regards to the context/ssr issues, i added another workaround, so please take a look

@zeroedin
Copy link
Collaborator

zeroedin commented Dec 6, 2024

Should we add a changeset line about this PR correcting the regression in rh-card or maybe noting a change to the consumer that corrects possible regressions in color-palette's ability to correctly apply instead of being specific to rh-card?

Copy link
Collaborator

@adamjohnson adamjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the docs, the focus states still need some love:

  • Background color needs to be changed / applied on focus
  • Ensure blue outline on focus across browsers

Focus state in Microsoft Edge:
Accordion with a focused item in Edge showing a black outline

Focus state in Safari:
Example of accordion focus in safari, noting the second item is focused and it's confusing

Note that in Safari, users could easily confuse which item is currently focused.

Copy link
Collaborator

@zeroedin zeroedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The font weight of the accordion panel headers looks different in Safari and Firefox then it does in Chrome.

Chrome:
image

Firefox:
image

Safari:
image

In fact manually changing Chrome's font weight to 500 and 700 does no visual change.

#header-text {
font-weight: var(--rh-font-weight-heading-bold, 700);
}

#button {
width: 100%;
padding:
var(--_padding-block-start)
var(--_padding-inline-end)
var(--_padding-block-end)
var(--_padding-inline-start);
font-family: var(--rh-font-family-body-text, RedHatText, 'Red Hat Text', 'Noto Sans Arabic', 'Noto Sans Hebrew', 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans Malayalam', 'Noto Sans SC', 'Noto Sans TC', 'Noto Sans Thai', Helvetica, Arial, sans-serif);
font-size: var(--_font-size);
color: var(--rh-color-text-primary);

I believe this has to do with the fonts stack we are loading and Chrome's difference in how it renders weights that aren't loaded for the stack. Where as I believe Safari and seemingly Firefox too will synthesize it if it is missing.. at least I believe I remember seeing that somewhere was the case for Safari although a quick search didn't return proof to that respect.

@font-face {
font-family: RedHatText;
src: url('../assets/fonts/RedHatText/RedHatText-Regular.woff');
font-style: normal;
font-weight: 400;
text-rendering: optimizelegibility;
}
@font-face {
font-family: RedHatText;
src: url('../assets/fonts/RedHatText/RedHatText-Medium.woff');
font-style: normal;
font-weight: 500;
text-rendering: optimizelegibility;
}

We do not load a 700 weight for RedHatText in our fonts.css file. We do however load a 700 weight for RedHatDisplay.

Are we sure we want to be using RedHatText for this header?

@font-face {
font-family: RedHatDisplay;
src: url('../assets/fonts/RedHatDisplay/RedHatDisplay-Bold.woff');
font-style: normal;
font-weight: 700;
text-rendering: optimizelegibility;
}

If so, we'll need to modify the font stack to accommodate the 700 weight for body text. Also that said tokens for body text only go to 500 so likely this isn't the font family we want here.

Quite possible we might just want to move this to another issue and fix outside this PR.

Otherwise the rest of the changes in the PR LGTM. @bennypowers at some point a small walk through on the lit ssr workaround maybe warranted just to make sure I have the correct understanding. As I understand it we are triggering a update with the prop change there to ensure the consumer fires it request event?

Update: moved to its own issue: #2083

@bennypowers
Copy link
Member Author

yes, @zeroedin : in my experiments, I found that no amount of host.requestUpdate('on') was helpful to dislodge the (incorrect) ssr value, but unsetting then resetting the property did trigger a rerender of that template part. I also found that I had to adjust some of the timing of the provider lifecycle so that monkey-in-the-middle late upgrading providers still work as expected both in the non-ssr (dev server) and ssr (eleventy) scenarios.

i'm looking forward to lit-ssr supporting this stuff so we can jettison our custom code

Copy link
Collaborator

@adamjohnson adamjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Links glow, tint modified

@bennypowers bennypowers merged commit 33535ef into main Dec 9, 2024
8 checks passed
@bennypowers bennypowers deleted the fix/accordion/heading-hover branch December 9, 2024 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done ☑️
Development

Successfully merging this pull request may close these issues.

[bug] <rh-accordion> not showing hover state
4 participants