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

Use isFocused instead of isFocusVisible for Input and Textarea components #2940

Merged
merged 2 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions packages/@headlessui-react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Expose `disabled` state on `<Tab />` component ([#2918](https://github.com/tailwindlabs/headlessui/pull/2918))
- Prevent default behaviour when clicking outside of a `Dialog.Panel` ([#2919](https://github.com/tailwindlabs/headlessui/pull/2919))
- Use `isFocused` instead of `isFocusVisible` for `Input` and `Textarea` components ([#2940](https://github.com/tailwindlabs/headlessui/pull/2940))

## [2.0.0-alpha.4] - 2024-01-03

Expand Down
10 changes: 2 additions & 8 deletions packages/@headlessui-react/src/components/combobox/combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1317,10 +1317,7 @@ function InputFn<
let labelledBy = useLabelledBy()
let describedBy = useDescribedBy()

let { isFocusVisible: focus, focusProps } = useFocusRing({
isTextInput: true,
autoFocus: props.autoFocus ?? false,
})
let { isFocused: focus, focusProps } = useFocusRing({ autoFocus: props.autoFocus ?? false })
let { isHovered: hover, hoverProps } = useHover({ isDisabled: data.disabled ?? false })

let slot = useMemo(
Expand Down Expand Up @@ -1479,10 +1476,7 @@ function ButtonFn<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(

let labelledBy = useLabelledBy([id])

let { isFocusVisible: focus, focusProps } = useFocusRing({
isTextInput: true,
autoFocus: props.autoFocus ?? false,
})
let { isFocusVisible: focus, focusProps } = useFocusRing({ autoFocus: props.autoFocus ?? false })
let { isHovered: hover, hoverProps } = useHover({ isDisabled: data.disabled ?? false })
let { pressed: active, pressProps } = useActivePress({ disabled: data.disabled ?? false })

Expand Down
3 changes: 1 addition & 2 deletions packages/@headlessui-react/src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ function InputFn<TTag extends ElementType = typeof DEFAULT_INPUT_TAG>(
let labelledBy = useLabelledBy()
let describedBy = useDescribedBy()

let { isFocusVisible: focus, focusProps } = useFocusRing({
isTextInput: true,
let { isFocused: focus, focusProps } = useFocusRing({
autoFocus: props.autoFocus ?? false,
})
let { isHovered: hover, hoverProps } = useHover({ isDisabled: disabled ?? false })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function TextareaFn<TTag extends ElementType = typeof DEFAULT_TEXTAREA_TAG>(
let labelledBy = useLabelledBy()
let describedBy = useDescribedBy()

let { isFocusVisible: focus, focusProps } = useFocusRing({ autoFocus: props.autoFocus ?? false })
let { isFocused: focus, focusProps } = useFocusRing({ autoFocus: props.autoFocus ?? false })
let { isHovered: hover, hoverProps } = useHover({ isDisabled: disabled ?? false })

let ourProps = mergeProps(
Expand Down