Loading toolkit/content/widgets/moz-toggle/moz-toggle.mjs +11 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,10 @@ import "chrome://global/content/elements/moz-label.mjs"; export default class MozToggle extends MozBaseInputElement { static properties = { pressed: { type: Boolean, reflect: true }, // Extension for tor-browser. Used for tor-browser#41333. title: { type: String, attribute: "title" }, // Extension for tor-browser. Used for tor-browser#40837. labelAlignAfter: { type: Boolean, attribute: "label-align-after" }, }; static activatedProperty = "pressed"; Loading @@ -49,6 +53,12 @@ export default class MozToggle extends MozBaseInputElement { inputTemplate() { const { pressed, disabled, ariaLabel, handleClick } = this; // For tor-browser, if we have a title we use it as the aria-description. // Used for tor-browser#41333. // Only set the description using the title if it differs from the // accessible name derived from the label. const label = ariaLabel || this.label; const ariaDescription = label === this.title ? undefined : this.title; return html`<button id="input" part="button" Loading @@ -60,6 +70,7 @@ export default class MozToggle extends MozBaseInputElement { aria-pressed=${pressed} aria-describedby="description" aria-label=${ifDefined(ariaLabel ?? undefined)} aria-description=${ifDefined(ariaDescription ?? undefined)} accesskey=${ifDefined(this.accessKey)} @click=${handleClick} ></button>`; Loading Loading
toolkit/content/widgets/moz-toggle/moz-toggle.mjs +11 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,10 @@ import "chrome://global/content/elements/moz-label.mjs"; export default class MozToggle extends MozBaseInputElement { static properties = { pressed: { type: Boolean, reflect: true }, // Extension for tor-browser. Used for tor-browser#41333. title: { type: String, attribute: "title" }, // Extension for tor-browser. Used for tor-browser#40837. labelAlignAfter: { type: Boolean, attribute: "label-align-after" }, }; static activatedProperty = "pressed"; Loading @@ -49,6 +53,12 @@ export default class MozToggle extends MozBaseInputElement { inputTemplate() { const { pressed, disabled, ariaLabel, handleClick } = this; // For tor-browser, if we have a title we use it as the aria-description. // Used for tor-browser#41333. // Only set the description using the title if it differs from the // accessible name derived from the label. const label = ariaLabel || this.label; const ariaDescription = label === this.title ? undefined : this.title; return html`<button id="input" part="button" Loading @@ -60,6 +70,7 @@ export default class MozToggle extends MozBaseInputElement { aria-pressed=${pressed} aria-describedby="description" aria-label=${ifDefined(ariaLabel ?? undefined)} aria-description=${ifDefined(ariaDescription ?? undefined)} accesskey=${ifDefined(this.accessKey)} @click=${handleClick} ></button>`; Loading