Skip to content

Commit 7b64379

Browse files
committed
fix(potentiometer): emit value in detail property
Currently, we emit an `input` even whenever the potentiometer value changes. This is on par with how `<input type="range">` works. However, the InputEvent emitted by `range` does not include any `data` property, and MDN says that "data" should include only the inserted characters, if any: https://developer.mozilla.org/en-US/docs/Web/API/InputEvent/data Thus, we use the `detail` property instead, which is also consistent with what we do in the membrane-keypad element.
1 parent e2a1b1c commit 7b64379

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/potentiometer-element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,6 @@ export class PotentiometerElement extends LitElement {
174174
const clamped = this.clamp(this.min, this.max, value);
175175
const updated = Math.round(clamped / this.step) * this.step;
176176
this.value = Math.round(updated * 100) / 100;
177-
this.dispatchEvent(new InputEvent('input', { data: `${this.value}` }));
177+
this.dispatchEvent(new InputEvent('input', { detail: this.value }));
178178
}
179179
}

0 commit comments

Comments
 (0)