rafaelmardojai / firefox-gnome-theme

A GNOME👣 theme for Firefox🔥
The Unlicense
3.49k stars 160 forks source link

gnomeTheme.hideSingleTab doesn't work with simple tab groups extension #709

Closed RTSAjwad closed 11 months ago

RTSAjwad commented 11 months ago

Describe the bug When enabling gnomeTheme.hideSingleTab, it still shows the single tab if you are using the simple tab groups extension. This is because there are technically multiple tabs but they are hidden. May this has to do with hidden tabs in general.

To Reproduce

  1. Use simple tab groups extension
  2. Enable gnomeTheme.hideSingleTab
  3. Make group with only a single tab in it the active group whilst there are other inactive groups with tabs in them
  4. Tab bar is still showing with one tab

Expected behavior The tab bar should be hidden with one tab even if there are other tab groups with tabs in them

Screenshots Screenshot from 2023-11-25 20-47-11 Here you can see with this screenshot that the single tab is showing even though gnomeTheme.hideSingleTab is turned on Screenshot from 2023-11-25 20-48-39 In this screenshot you can see that there are technically other tabs but they are in another group

Setup information

rafaelmardojai commented 11 months ago

Yes, this is a known limitation and not really fixable, I should probably document this in the README.

The problem is that when extensions hide tabs, they're still there in the tab bar, just visually hidden, so there's no way to know from CSS that there's only one tab that's not hidden.

Before Firefox 110, we had the first-visible-tab and last-visible-tab attributes in tabs, and if a tab had both true it could be hidden, but Mozilla removed them.

RTSAjwad commented 11 months ago

Ahh I understand now. Thanks for the information. Also you've done a great job with this project because it work fantastically!

amkige commented 10 months ago

Since :has is now supported in Firefox 121, it is possible.

In firefox-gnome-theme/theme/parts/tabsbar.css

replace

#tabbrowser-tabs tab:only-of-type

with

#tabbrowser-tabs:not(:has(tab:not([hidden="true"]) ~ tab:not([hidden="true"]))) tab

Not sure if the selector could be simplified but it works.