Comments (3)
Hmm, this looks like a regression from the V7 changes. The same code looks fine in v6.13.3: https://codesandbox.io/s/issue-1622-selected-tab-doc3fp
It looks like using the Link
component instead of an a
tag directly should also style correctly, as a workaround on v7:
<Tab
href={hash}
is={Link}
isSelected={selectedIndex === index}
appearance="primary"
key={tab}
onClick={() => setSelectedIndex(index)}
>
{tab}
</Tab>
from evergreen.
I do think you're on to something with the incorrect selectors being generated - I think that's an edge case in the newer ui-box
features that wasn't handled properly. The selector for _current
maps to this:
Line 27 in e13b9b4
The nested selectors defined in the theme (i.e. :before
and :after
) should be attached to both of these:
evergreen/src/themes/default/components/tab.js
Lines 45 to 51 in e13b9b4
However, these are only being attached to the last of the parent selectors, as you noted:
-.ub-tfrm_qu4iyp_fiauus[aria-current="page"], .ub-tfrm_qu4iyp_fiauus[aria-selected="true"]:before {
+.ub-tfrm_qu4iyp_fiauus[aria-current="page"]:before, .ub-tfrm_qu4iyp_fiauus[aria-selected="true"]:before {
transform: scaleY(1);
}
I should have a PR up there to fix it soon, and then we can bring it in here. It seems to solve the issue without having to change the existing tab.js
theme file.
Once this lands, I don't think you should need the aria-selected={selectedIndex === index}
prop anymore (since it sets aria-current="page"
internally if isSelected
is true).
from evergreen.
Thanks for the reply! I'll use the workaround until a fix is applied.
Edit: FYI for future readers: I added aria-selected={selectedIndex === index}
prop to the Tab component (along with isSelected={selectedIndex === index}
) for workaround(Using Link
component styles the text little bit differently, which is not what I wanted).
from evergreen.
Related Issues (20)
- Textarea component loses borders under certain conditions
- Property 'children' does not exist on type 'IntrinsicAttributes & TooltipProps'. HOT 4
- SSR with Remix HOT 3
- `SideSheet` prevents page scroll even after closing, when `preventBodyScrolling` set to true HOT 3
- Property `selected` should include `PropTypes.number` to allow integer values HOT 1
- Can't use (intent) and (type) property at the same time in <Button> component HOT 1
- Badge color should not have 'automatic' in its typing
- Feature request: Tooltip pointer arrow triangle shape (optional) HOT 1
- LinkProps.target should be `HTMLAttributeAnchorTarget | undefined`
- Button disabled icon color doesn't change HOT 2
- Badge no longer shows text if you pass color hex code HOT 8
- CSS modification HOT 1
- Ability to handle overlay/close clicks in Dialog component, onBeforeClose HOT 2
- inputValue.trim is not a function when using object array for items in autocomplete with "allowOtherValues"
- NextJs 13 App Router
- zIndex for Toaster HOT 1
- Toaster CSS Overide
- Project still maintained? HOT 13
- Footer Component Positioning Problem HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from evergreen.