Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix bug.
  • Loading branch information
DaniGuardiola committed Sep 2, 2024
commit c347fadff4ba935c91ec4e620a17e9fb32008400
13 changes: 7 additions & 6 deletions packages/components/src/tabs/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,25 @@ export const TabListWrapper = styled.div`
position: absolute;
pointer-events: none;

// Windows high contrast mode.
outline: 2px solid transparent;
outline-offset: -1px;
}
&:not( [aria-orientation='vertical'] ) {
--direction-factor: 1;
--indicator-start: var( --indicator-left );
&:dir( rtl ) {
--direction-factor: -1;
--indicator-start: var( --indicator-right );
}
transform-origin: calc( ( 1 - var( --direction-factor ) ) * 50% ) 0%;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be tricky to understand for a developer with fresh eyes — should we add a comment explaining that, based on the writing direction, the x-axis transform origin may be either 0% or 100% ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Honestly I think I'm just gonna use another variable (something like direction-x-origin) and explicitly write the value. Readable > smart.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it, let me know what you think.


// Windows high contrast mode.
outline: 2px solid transparent;
outline-offset: -1px;
}
&:not( [aria-orientation='vertical'] ) {
&::after {
bottom: 0;
height: 0;
/* Using a large value to avoid antialiasing rounding issues
when scaling in the transform, see: https://stackoverflow.com/a/52159123 */
width: 100px;
transform-origin: calc( ( 1 - var( --direction-factor ) ) * 50% ) 0%;
transform: translateX(
calc(
var( --indicator-start ) * var( --direction-factor ) *
Expand Down