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

<rh-tile> should default to setting a background of lightest #2023

Open
zeroedin opened this issue Oct 31, 2024 · 0 comments
Open

<rh-tile> should default to setting a background of lightest #2023

zeroedin opened this issue Oct 31, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@zeroedin
Copy link
Collaborator

zeroedin commented Oct 31, 2024

Initial report:

Michael Wells [Oct 18th at 11:17 AM]
new thing. rh-tile used to have a white bg as a default, it no longer does. is that purposeful?

Excerpt from rh-tile.css

https://github.com/RedHat-UX/red-hat-design-system/blob/33f88dab8e4a3f9e329c2fd3614e3363a3e00fc8/elements/rh-tile/rh-tile.css#L60-L65

Tile currently is only setting its background color when explicitly given a palette. Otherwise it allows the background of whatever its placed on to bleed through (this could be bad for accessibility)

Question:
With the implementation of theming tokens, should tile set it's color-palette="lightest" if left undefined.

Excerpt from rh-tile.ts

/**
* Sets color palette, which affects the element's styles as well as descendants' color theme.
* Overrides parent color context.
* Your theme will influence these colors so check there first if you are seeing inconsistencies.
* See [CSS Custom Properties](#css-custom-properties) for default values
*
* Tile always resets its context to `base`, unless explicitly provided with a `color-palette`.
*/
@colorContextProvider()
@property({ reflect: true, attribute: 'color-palette' }) colorPalette?: ColorPalette;

The comment, gives me pause. Base was a concept we haven't implemented. I'm assuming the code here was written to still fulfill this orphaned idea?

Tile always resets its context to base, unless explicitly provided with a color-palette.

Should the fix be. If color-palette is undefined set to lightest

  @colorContextProvider()
  @property({ reflect: true, attribute: 'color-palette' }) colorPalette: ColorPalette = lightest;

or in the css when .light or .dark gets set to the #outer

  &.light {
    --rh-color-surface: var(--rh-color-surface-lightest, #ffffff);
  &.dark {
    --rh-color-surface: var(--rh-color-surface-darkest, #151515);
    --_focus-background-color:
      var(--rh-tile-focus-background-color,
        var(--rh-color-surface-darker, #1f1f1f));
    --_disabled-background-color:
      var(--rh-tile-disabled-background-color,
        var(--rh-color-surface-dark, #383838));
  }

and move that above the & .palette-lightest - darkest rules?

Doing the later will cause a tile to always appear "darkest" on a dark parent context, unless overridden by setting its own color-palette.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

1 participant