Fix autofocusing Emoji reaction picker search (#10599)
This commit is contained in:
@@ -98,6 +98,7 @@ export function Outer({
|
|||||||
}: React.PropsWithChildren<{
|
}: React.PropsWithChildren<{
|
||||||
showCancel?: boolean
|
showCancel?: boolean
|
||||||
style?: StyleProp<ViewStyle>
|
style?: StyleProp<ViewStyle>
|
||||||
|
onCloseAutoFocus?: (event: Event) => void
|
||||||
}>) {
|
}>) {
|
||||||
const context = useMenuContext()
|
const context = useMenuContext()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
|||||||
@@ -181,9 +181,13 @@ export function Trigger({
|
|||||||
export function Outer({
|
export function Outer({
|
||||||
children,
|
children,
|
||||||
style,
|
style,
|
||||||
|
onCloseAutoFocus,
|
||||||
}: React.PropsWithChildren<{
|
}: React.PropsWithChildren<{
|
||||||
showCancel?: boolean
|
showCancel?: boolean
|
||||||
style?: StyleProp<ViewStyle>
|
style?: StyleProp<ViewStyle>
|
||||||
|
onCloseAutoFocus?: React.ComponentProps<
|
||||||
|
typeof DropdownMenu.Content
|
||||||
|
>['onCloseAutoFocus']
|
||||||
}>) {
|
}>) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {reduceMotionEnabled} = useA11y()
|
const {reduceMotionEnabled} = useA11y()
|
||||||
@@ -195,6 +199,7 @@ export function Outer({
|
|||||||
collisionPadding={{left: 5, right: 5, bottom: 5}}
|
collisionPadding={{left: 5, right: 5, bottom: 5}}
|
||||||
loop
|
loop
|
||||||
aria-label="Test"
|
aria-label="Test"
|
||||||
|
onCloseAutoFocus={onCloseAutoFocus}
|
||||||
className="dropdown-menu-transform-origin dropdown-menu-constrain-size">
|
className="dropdown-menu-transform-origin dropdown-menu-constrain-size">
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
|
|||||||
@@ -68,7 +68,19 @@ function MenuInner({
|
|||||||
return expanded ? (
|
return expanded ? (
|
||||||
<EmojiPicker.Picker keepOpenWhenShiftHeld={false} />
|
<EmojiPicker.Picker keepOpenWhenShiftHeld={false} />
|
||||||
) : (
|
) : (
|
||||||
<Menu.Outer style={[a.rounded_full]}>
|
<Menu.Outer
|
||||||
|
style={[a.rounded_full]}
|
||||||
|
onCloseAutoFocus={evt => {
|
||||||
|
// If something has already taken focus (e.g. emoji-mart's search
|
||||||
|
// input when swapping to the full picker), don't let Radix restore
|
||||||
|
// focus to the trigger and steal it back.
|
||||||
|
if (
|
||||||
|
document.activeElement &&
|
||||||
|
document.activeElement !== document.body
|
||||||
|
) {
|
||||||
|
evt.preventDefault()
|
||||||
|
}
|
||||||
|
}}>
|
||||||
<View style={[a.flex_row, a.gap_xs]}>
|
<View style={[a.flex_row, a.gap_xs]}>
|
||||||
{['❤️', '👍', '😆', '👀', '😢'].map(emoji => {
|
{['❤️', '👍', '😆', '👀', '😢'].map(emoji => {
|
||||||
const alreadyReacted = hasAlreadyReacted(
|
const alreadyReacted = hasAlreadyReacted(
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ let MessageItem = ({
|
|||||||
const avatar =
|
const avatar =
|
||||||
profile && moderationOpts ? (
|
profile && moderationOpts ? (
|
||||||
<Link
|
<Link
|
||||||
|
style={[a.rounded_full]}
|
||||||
label={l`${createSanitizedDisplayName(profile)}’s avatar`}
|
label={l`${createSanitizedDisplayName(profile)}’s avatar`}
|
||||||
accessibilityHint={l`Opens this profile`}
|
accessibilityHint={l`Opens this profile`}
|
||||||
to={makeProfileLink({
|
to={makeProfileLink({
|
||||||
|
|||||||
Reference in New Issue
Block a user