Skip to content

Commit c93c77d

Browse files
committed
Bug 1884170 - Missing options button icon in history fixed r=fxview-reviewers,kcochrane
Added correct secondary class names to show options button icon in history. Differential Revision: https://phabricator.services.mozilla.com/D203928
1 parent a15a362 commit c93c77d

File tree

4 files changed

+30
-28
lines changed

4 files changed

+30
-28
lines changed

browser/components/firefoxview/fxview-tab-list.mjs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,27 @@ export class FxviewTabRow extends MozLitElement {
929929
? "0"
930930
: "-1"}"
931931
></button>`
932+
)}
933+
${when(
934+
this.tertiaryL10nId && this.tertiaryActionHandler,
935+
() => html`<button
936+
class=${classMap({
937+
"fxview-tab-row-button": true,
938+
"ghost-button": true,
939+
"icon-button": true,
940+
"semi-transparent": true,
941+
[this.tertiaryActionClass]: this.tertiaryActionClass,
942+
})}
943+
id="fxview-tab-row-tertiary-button"
944+
data-l10n-id=${this.tertiaryL10nId}
945+
data-l10n-args=${ifDefined(this.tertiaryL10nArgs)}
946+
aria-haspopup=${ifDefined(this.hasPopup)}
947+
@click=${this.tertiaryActionHandler}
948+
tabindex="${this.active &&
949+
this.currentActiveElementId === "fxview-tab-row-tertiary-button"
950+
? "0"
951+
: "-1"}"
952+
></button>`
932953
)}`;
933954
}
934955

@@ -956,27 +977,6 @@ export class FxviewTabRow extends MozLitElement {
956977
this.#pinnedTabItemTemplate.bind(this),
957978
this.#unpinnedTabItemTemplate.bind(this)
958979
)}
959-
${when(
960-
this.tertiaryL10nId && this.tertiaryActionHandler,
961-
() => html`<button
962-
class=${classMap({
963-
"fxview-tab-row-button": true,
964-
"ghost-button": true,
965-
"icon-button": true,
966-
"semi-transparent": true,
967-
[this.tertiaryActionClass]: this.tertiaryActionClass,
968-
})}
969-
id="fxview-tab-row-tertiary-button"
970-
data-l10n-id=${this.tertiaryL10nId}
971-
data-l10n-args=${ifDefined(this.tertiaryL10nArgs)}
972-
aria-haspopup=${ifDefined(this.hasPopup)}
973-
@click=${this.tertiaryActionHandler}
974-
tabindex="${this.active &&
975-
this.currentActiveElementId === "fxview-tab-row-tertiary-button"
976-
? "0"
977-
: "-1"}"
978-
></button>`
979-
)}
980980
`;
981981
}
982982

browser/components/firefoxview/history.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ class HistoryInView extends ViewPage {
442442
</h3>
443443
<fxview-tab-list
444444
slot="main"
445-
class="with-context-menu"
445+
secondaryActionClass="options-button"
446446
dateTimeFormat="dateTime"
447447
hasPopup="menu"
448448
maxTabsLength=${this.maxTabsLength}
@@ -520,7 +520,7 @@ class HistoryInView extends ViewPage {
520520
)}
521521
<fxview-tab-list
522522
slot="main"
523-
class="with-context-menu"
523+
secondaryActionClass="options-button"
524524
dateTimeFormat="dateTime"
525525
hasPopup="menu"
526526
maxTabsLength="-1"

browser/components/firefoxview/syncedtabs.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ class SyncedTabsInView extends ViewPage {
419419
</h3>
420420
<fxview-tab-list
421421
slot="main"
422-
class="with-context-menu"
422+
secondaryActionClass="options-button"
423423
hasPopup="menu"
424424
.tabItems=${ifDefined(tabItems)}
425425
.searchQuery=${this.searchQuery}

browser/components/storybook/stories/fxview-tab-list.stories.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ And used as follows:
2828
With context menu:
2929
```html
3030
<fxview-tab-list
31-
class="with-context-menu"
31+
secondaryActionClass="options-button"
3232
.dateTimeFormat=${"relative"}
3333
.hasPopup=${"menu"}
3434
.maxTabsLength=${this.maxTabsLength}
@@ -97,10 +97,12 @@ You'll need to pass along some of the following properties:
9797

9898
### Notes
9999

100-
* In order to keep this as generic as possible, the icon for the secondary action button will NOT have a default. You can supply a `class` attribute to an instance of `fxview-tab-list` in order to apply styles to things like the icon for the secondary action button. In the above example, I added a class `"with-context-menu"` to `fxview-tab-list`, so I can update the button's icon by using:
100+
* In order to keep this as generic as possible, the icon for the secondary action button will NOT have a default. You can supply a `class` attribute to an instance of `fxview-tab-list` in order to apply styles to things like the icon for the secondary action button. In the above example, I added a `secondaryActionClass` `"options-button"` to `fxview-tab-list`, so I can update the button's icon by using:
101101
```css
102-
fxview-tab-list.with-context-menu::part(secondary-button) {
103-
background-image: url("chrome://global/skin/icons/more.svg");
102+
.fxview-tab-row-button {
103+
&.options-button {
104+
background-image: url("chrome://global/skin/icons/more.svg");
105+
}
104106
}
105107
```
106108
* You'll also need to define functions for the `fxview-tab-list-primary-action` and `fxview-tab-list-secondary-action` listeners in order to add functionality to the primary element and the secondary button.

0 commit comments

Comments
 (0)