Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark the current successor tab with [data-successor] attribute #1882

Open
wants to merge 1 commit into
base: v5
Choose a base branch
from

Conversation

emvaized
Copy link
Contributor

@emvaized emvaized commented Nov 23, 2024

This pull request is a proposed solution for #1495

It adds [data-successor] attribute for a tab which is currently a successor for the current one (will be activated when the current one is closed). With the setting Tabs > After closing current tab: previously active tab it will add this attribute to the previously active tab, esentially replicating the "previous tab highlight" feature from the Arc browser.

Here's an example with Mouse > Tab actions > Activate previously active tab when clicking on the active tab (Tab flip) enabled:

2024-11-24.003712.mp4

Custom CSS rule used:

.Tab[data-successor="true"] .fav:before{
	content: "";
	position:absolute;
	background: var(--tabs-activated-bg);
	border-radius: var(--tabs-border-radius);
	box-shadow: var(--tabs-activated-shadow);
	outline: 1px solid lightgray;
	height: calc(16px + 10px);
	top: calc(-10px + 4px);
	width: calc(16px + 3px);
	left: -1.5px;
}

Another possible solution would be to use [data-last-active] attribute instead, and set it on every tab activation in onTabActivated. Probably it's a better solution to achieve the described behavior, but then it is not properly updated on tab close (newly focused tab remains with the last active attribute).

I got the impression that marking the successor tab works more reliably for this purpose in all usage scenarios I tested:

  • on tab flip when click on the current tab
  • on tab close when "activate previous tab" is enabled
  • on current tab suspend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant