Skip to content

Commit 513aa2f

Browse files
WestbrookWestbrook Johnson
authored and
Westbrook Johnson
committed
fix(color-area): remove deprecated "label" attribute/property
BREAKING CHANGE: set labels via the label-x/label-y attributes or labelX/labelY properties
1 parent 50ec21c commit 513aa2f

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

packages/color-area/README.md

-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ An `<sp-color-area>`’s height and width can be customized appropriately for it
6969
An `<sp-color-area>` renders accessible labels for each axis: _"saturation"_ and _"luminosity"_.
7070
Specify `label-x` and `label-y` attributes to override these defaults.
7171

72-
The `label` attribute is **deprecated** in favor of separately labeling each axis.
73-
7472
```html
7573
<sp-color-area
7674
label-x="Color intensity"

packages/color-area/src/ColorArea.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ export class ColorArea extends SpectrumElement {
5050
@property({ type: Boolean, reflect: true })
5151
public focused = false;
5252

53-
@property({ type: String })
54-
public label: string | undefined;
55-
5653
@property({ type: String, attribute: 'label-x' })
5754
public labelX = 'saturation';
5855

@@ -487,7 +484,7 @@ export class ColorArea extends SpectrumElement {
487484
type="range"
488485
class="slider"
489486
name="x"
490-
aria-label=${this.label ?? this.labelX}
487+
aria-label=${this.labelX}
491488
min="0"
492489
max="1"
493490
step=${this.step}
@@ -502,7 +499,7 @@ export class ColorArea extends SpectrumElement {
502499
type="range"
503500
class="slider"
504501
name="y"
505-
aria-label=${this.label ?? this.labelY}
502+
aria-label=${this.labelY}
506503
min="0"
507504
max="1"
508505
step=${this.step}

packages/color-area/test/color-area.test.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,25 @@ describe('ColorArea', () => {
109109
expect(inputX?.getAttribute('aria-label')).to.equal('saturation');
110110
expect(inputY?.getAttribute('aria-label')).to.equal('luminosity');
111111
});
112-
it('overrides both X and Y labels with a provided "label" attribute', async () => {
112+
it('overrides both X and Y labels with a provided custom attributes', async () => {
113113
const el = await fixture<ColorArea>(
114114
html`
115115
<sp-color-area
116116
color="hsl(100, 50%, 50%)"
117-
label="something custom"
117+
label-x="something custom, saturation"
118+
label-y="something custom, luminosity"
118119
></sp-color-area>
119120
`
120121
);
121122
const inputX = el.shadowRoot.querySelector('input[name="x"]');
122123
const inputY = el.shadowRoot.querySelector('input[name="y"]');
123124

124-
expect(inputX?.getAttribute('aria-label')).to.equal('something custom');
125-
expect(inputY?.getAttribute('aria-label')).to.equal('something custom');
125+
expect(inputX?.getAttribute('aria-label')).to.equal(
126+
'something custom, saturation'
127+
);
128+
expect(inputY?.getAttribute('aria-label')).to.equal(
129+
'something custom, luminosity'
130+
);
126131
});
127132
it('accepts "color" values as hsl', async () => {
128133
const el = await fixture<ColorArea>(

0 commit comments

Comments
 (0)