mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 23:06:40 +00:00
Disable pointer events when disabled (#6155)
This commit is contained in:
parent
71137032df
commit
6d6eef4e97
@ -24,28 +24,21 @@ export class HaIconButton extends LitElement {
|
||||
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<mwc-icon-button
|
||||
.label=${this.label}
|
||||
?disabled=${this.disabled}
|
||||
@click=${this._handleClick}
|
||||
>
|
||||
<mwc-icon-button .label=${this.label} .disabled=${this.disabled}>
|
||||
<ha-icon .icon=${this.icon}></ha-icon>
|
||||
</mwc-icon-button>
|
||||
`;
|
||||
}
|
||||
|
||||
private _handleClick(ev) {
|
||||
if (this.disabled) {
|
||||
ev.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
||||
static get styles(): CSSResult {
|
||||
return css`
|
||||
:host {
|
||||
display: inline-block;
|
||||
outline: none;
|
||||
}
|
||||
:host([disabled]) {
|
||||
pointer-events: none;
|
||||
}
|
||||
mwc-icon-button {
|
||||
--mdc-theme-on-primary: currentColor;
|
||||
--mdc-theme-text-disabled-on-light: var(--disabled-text-color);
|
||||
|
Loading…
x
Reference in New Issue
Block a user