add click method

pull/411/head
Cory LaViska 2021-04-01 08:40:48 -04:00
rodzic 619758cbc3
commit 784c173728
5 zmienionych plików z 16 dodań i 1 usunięć

Wyświetl plik

@ -8,6 +8,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis
## Next
- Added `click()` method to `sl-checkbox`, `sl-radio`, and `sl-switch`
- Fixed a bug in `sl-tooltip` where events weren't properly cleaned up on disconnect
- Fixed a bug in `sl-tooltip` where they wouldn't display after toggling `disabled` off and on again [#391](https://github.com/shoelace-style/shoelace/issues/391)
- Improved a11y for disabled buttons that are rendered as links

Wyświetl plik

@ -86,7 +86,6 @@ export default class SlButton extends LitElement {
/** Simulates a click on the button. */
click() {
this.button.focus();
this.button.click();
}

Wyświetl plik

@ -63,6 +63,11 @@ export default class SlCheckbox extends LitElement {
this.input.indeterminate = this.indeterminate;
}
/** Simulates a click on the checkbox. */
click() {
this.input.click();
}
/** Sets focus on the checkbox. */
focus(options?: FocusOptions) {
this.input.focus(options);

Wyświetl plik

@ -55,6 +55,11 @@ export default class SlRadio extends LitElement {
/** Emitted when the control gains focus. */
@event('sl-focus') slFocus: EventEmitter<void>;
/** Simulates a click on the radio. */
click() {
this.input.click();
}
/** Sets focus on the radio. */
focus(options?: FocusOptions) {
this.input.focus(options);

Wyświetl plik

@ -55,6 +55,11 @@ export default class SlSwitch extends LitElement {
/** Emitted when the control gains focus. */
@event('sl-focus') slFocus: EventEmitter<void>;
/** Simulates a click on the switch. */
click() {
this.input.click();
}
/** Sets focus on the switch. */
focus(options?: FocusOptions) {
this.input.focus(options);