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: opacity checkerboard inclusion order #3651

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/color-loupe/src/ColorLoupe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import opacityCheckerboardStyles from '@spectrum-web-components/opacity-checkerb
*/
export class ColorLoupe extends SpectrumElement {
public static override get styles(): CSSResultArray {
return [styles, opacityCheckerboardStyles];
return [opacityCheckerboardStyles, styles];
}

@property({ type: Boolean, reflect: true })
Expand Down
11 changes: 6 additions & 5 deletions tools/opacity-checkerboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@ The `opacity-checkerboard` class is used to highlight opacity. Leverage these st

## Usage

Import the styles from `opacity-checkerboard` css
Import the styles from the `opacity-checkerboard` CSS:

```
import opacityCheckeryBoardStyles from '@spectrum-web-components/tools/opacity-checkerboard/src/opacity-checkerboard.css.js';
import opacityCheckerBoardStyles from '@spectrum-web-components/opacity-checkerboard/src/opacity-checkerboard.css.js';
```

Add it to your component's styles array
Add it to your component's styles array before your component's styles. The order that you include the styles in makes a difference, because selectors within opacity checkerboard may have the same
specificity as those within your component.

```js
public static override get styles(): CSSResultArray {
return [...styles, opacityCheckeryBoardStyles];
return [opacityCheckerBoardStyles, styles];
}
```

Use the `opacity-checkerboard` class in `render()` method
Use the `opacity-checkerboard` class in your component's `render()` method:

```html-live demo
<div
Expand Down