-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: make focus visible to improve clarity for keyboard users #2222
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
base: main
Are you sure you want to change the base?
Changes from 10 commits
c08dcc1
d3bf734
14d9869
6568fa9
611f9f4
f467892
461256b
99eba62
b3b2bbc
a41e53f
aec66d2
308bf54
d2530fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,13 @@ export type CardItem = { | |
buttonIcon?: 'arrow-right' | 'external-arrow' | ||
} | ||
|
||
export default function Card({ title, href, description, theme, buttonIcon = "arrow-right" }: CardItem) { | ||
export default function Card({ | ||
title, | ||
href, | ||
description, | ||
theme, | ||
buttonIcon = 'arrow-right', | ||
}: CardItem) { | ||
const [isHovered, setIsHovered] = useState(false) | ||
|
||
return ( | ||
|
@@ -47,7 +53,7 @@ export default function Card({ title, href, description, theme, buttonIcon = "ar | |
|
||
{href && ( | ||
<Button | ||
as="button" | ||
as="div" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Button Component Fails When Using
|
||
label={false} | ||
type={theme === 'dark' ? 'secondary' : 'primary'} | ||
icon={buttonIcon} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
:root { | ||
--focus-outline-color-light: #0066cc; | ||
--focus-outline-color-dark: #4da6ff; | ||
} | ||
|
||
[data-theme='dark'] { | ||
--focus-outline-color-light: var(--focus-outline-color-dark); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Button Component Fails with
as="div"
The
Button
component, whenas="div"
, fails to resolve the component type iflinkComponentMap
lacks a 'div' entry, causing a runtime error ('Element type is invalid'). Additionally, its logic incorrectly passes anchor-specific attributes (href
,target
,rel
,download
,disabled
) to thediv
element (due to applying them wheneveras !== 'button'
), resulting in invalid HTML and React warnings. TheButton
component should ensure proper component resolution foras="div"
and only apply anchor-related attributes for 'a' or 'link' types.Additional Locations (1)
src/components/elements/buttons/button/index.tsx#L23-L24