Commit a713987d authored by henry's avatar henry Committed by brizental
Browse files

fixup! Customize moz-toggle for tor-browser.

TB 43727: Drop the moz-toggle label-align-after attribute.

Upstream now does this by default. Instead we add the label-align-before
attribute for the exception in about:tor.
parent bda54915
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -253,6 +253,9 @@ export class MozBaseInputElement extends MozLitElement {
    accessKey: { type: String, mapped: true, fluent: true },
    parentDisabled: { type: Boolean, state: true },
    ariaLabel: { type: String, mapped: true },
    // label-align-before is a customisation for the moz-toggle in about:tor.
    // See tor-browser#43727.
    labelAlignBefore: { type: Boolean, attribute: "label-align-before" },
  };
  static inputLayout = "inline";

@@ -411,9 +414,10 @@ export class MozBaseInputElement extends MozLitElement {
          part="label"
          for="input"
          shownaccesskey=${ifDefined(this.accessKey)}
          >${this.isInlineLayout
          >${this.labelAlignBefore ? this.labelTemplate() : ""}${this
            .isInlineLayout
            ? this.inputTemplate()
            : ""}${this.labelTemplate()}</label
            : ""}${this.labelAlignBefore ? "" : this.labelTemplate()}</label
        >${this.hasDescription ? "" : this.supportLinkTemplate()}
      </span>
      ${this.descriptionTemplate()}
+9 −1
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
    --input-margin-block-adjust: calc((1lh - var(--input-height)) / 2);
    --icon-margin-block-adjust: calc((1lh - var(--icon-size)) / 2);
    --input-margin-inline-start-adjust: calc(-1 * var(--input-space-offset));
    --input-margin-inline-adjust: var(--input-margin-inline-start-adjust) var(--space-small);
  }

  :host(:not([hidden])) {
@@ -32,6 +33,13 @@
    --input-margin-block-adjust: 0;
  }

  :host([label-align-before]) {
    /* The label is before the input, so we need the input to only have a
     * starting gap between it and the label. */
    --input-space-offset: 0;
    --input-margin-inline-adjust: var(--space-small) 0;
  }

  @media (forced-colors) {
    :host(:state(disabled)) {
      color: GrayText;
@@ -79,7 +87,7 @@
    line-height: inherit;
    vertical-align: top;
    margin-block: var(--input-margin-block-adjust);
    margin-inline: var(--input-margin-inline-start-adjust) var(--space-small);
    margin-inline: var(--input-margin-inline-adjust);

    :host(:not(:state(has-label))) & {
      margin-inline-end: 0;
+0 −2
Original line number Diff line number Diff line
@@ -26,8 +26,6 @@ export default class MozToggle extends MozBaseInputElement {
    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";