Skip to content

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