Commit 677029b3 authored by henry's avatar henry Committed by brizental
Browse files

fixup! Customize moz-toggle for tor-browser.

TB 44419: Re-add the moz-toggle title attribute patch.
parent b1beb7c2
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -51,6 +51,22 @@ export default class MozToggle extends MozBaseInputElement {

  inputTemplate() {
    const { pressed, disabled, ariaLabel, handleClick } = this;
    let ariaDescription = undefined;
    if (!this.hasDescription) {
      ariaDescription = this.ariaDescription;
      if (
        !ariaDescription &&
        this.title &&
        this.title !== (ariaLabel || this.label)
      ) {
        // 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 (ariaLabel || this.label).
        ariaDescription = this.title;
      }
    }

    return html`<button
      id="input"
      part="button"
@@ -62,9 +78,7 @@ export default class MozToggle extends MozBaseInputElement {
      aria-pressed=${pressed}
      aria-label=${ifDefined(ariaLabel ?? undefined)}
      aria-describedby="description"
      aria-description=${ifDefined(
        this.hasDescription ? undefined : this.ariaDescription
      )}
      aria-description=${ifDefined(ariaDescription)}
      accesskey=${ifDefined(this.accessKey)}
      @click=${handleClick}
    ></button>`;