Skip to content

Commit befdc04

Browse files
authored
docs: Improve navigation experience (#9260)
* Remove v0 for now * Fix mobile toc * Improve controls on mobile * Better use of space * Fix some examples that are too wide on iPhone * Disable tap highlight * Link more components in API section * Link to forms guide * Hide render props table in S2 It's not clear what it is there * Bring back bullets for related pages * Attempt to improve prefetching * Refactor router/skeleton * Fix clicking card causing focus ring * Smoother page transitions when using search menu * Use view transition for mobile search menu * Reset scroll position when switching tags * Fix test * Reset selected tag when search menu closes * Fix view transition * Fix scrolling on android * Fix skeleton for component pages * Fix infinite loop when closing search menu on RSP homepage
1 parent b47ceb1 commit befdc04

File tree

91 files changed

+1112
-815
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1112
-815
lines changed

packages/@react-aria/interactions/src/useFocusVisible.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// NOTICE file in the root directory of this source tree.
1616
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
1717

18-
import {getOwnerDocument, getOwnerWindow, isMac, isVirtualClick} from '@react-aria/utils';
18+
import {getOwnerDocument, getOwnerWindow, isMac, isVirtualClick, openLink} from '@react-aria/utils';
1919
import {ignoreFocusEvent} from './utils';
2020
import {useEffect, useState} from 'react';
2121
import {useIsSSR} from '@react-aria/ssr';
@@ -68,7 +68,7 @@ function isValidKey(e: KeyboardEvent) {
6868

6969
function handleKeyboardEvent(e: KeyboardEvent) {
7070
hasEventBeforeFocus = true;
71-
if (isValidKey(e)) {
71+
if (!(openLink as any).isOpening && isValidKey(e)) {
7272
currentModality = 'keyboard';
7373
triggerChangeHandlers('keyboard', e);
7474
}
@@ -83,7 +83,7 @@ function handlePointerEvent(e: PointerEvent | MouseEvent) {
8383
}
8484

8585
function handleClickEvent(e: MouseEvent) {
86-
if (isVirtualClick(e)) {
86+
if (!(openLink as any).isOpening && isVirtualClick(e)) {
8787
hasEventBeforeFocus = true;
8888
currentModality = 'virtual';
8989
}

packages/@react-aria/utils/src/openLink.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export function openLink(target: HTMLAnchorElement, modifiers: Modifiers, setOpe
106106
let event = isWebKit() && isMac() && !isIPad() && process.env.NODE_ENV !== 'test'
107107
// @ts-ignore - keyIdentifier is a non-standard property, but it's what webkit expects
108108
? new KeyboardEvent('keydown', {keyIdentifier: 'Enter', metaKey, ctrlKey, altKey, shiftKey})
109-
: new MouseEvent('click', {metaKey, ctrlKey, altKey, shiftKey, bubbles: true, cancelable: true});
109+
: new MouseEvent('click', {metaKey, ctrlKey, altKey, shiftKey, detail: 1, bubbles: true, cancelable: true});
110110
(openLink as any).isOpening = setOpening;
111111
focusWithoutScrolling(target);
112112
target.dispatchEvent(event);

packages/@react-spectrum/s2/src/Calendar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ const cellStyles = style({
141141
isOutsideMonth: 'none'
142142
},
143143
alignItems: 'center',
144-
justifyContent: 'center'
144+
justifyContent: 'center',
145+
disableTapHighlight: true
145146
});
146147

147148
const cellInnerStyles = style<CalendarCellRenderProps & {selectionMode: 'single' | 'range'}>({

packages/@react-spectrum/s2/src/CloseButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ const styles = style<CloseButtonProps & {isHovered: boolean, isFocusVisible: boo
7676
default: 'focus-ring',
7777
isStaticColor: 'transparent-overlay-1000',
7878
forcedColors: 'Highlight'
79-
}
79+
},
80+
disableTapHighlight: true
8081
}, getAllowedOverrides());
8182

8283
export const CloseButtonContext = createContext<ContextValue<Partial<CloseButtonProps>, FocusableRefValue<HTMLButtonElement>>>(null);

packages/@react-spectrum/s2/src/ColorSwatchPicker.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ function useWrapper(swatch: ReactElement, color: Color, rounding: ColorSwatchPro
9090
default: 'sm',
9191
full: 'full'
9292
}
93-
}
93+
},
94+
disableTapHighlight: true
9495
})({...renderProps, rounding})}>
9596
{({isSelected}) => (<>
9697
{swatch}

packages/@react-spectrum/s2/src/DropZone.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ const dropzone = style<DropZoneRenderProps>({
6565
isFocusVisible: 'blue-800'
6666
},
6767
borderRadius: 'lg',
68-
padding: 24
68+
padding: 24,
69+
boxSizing: 'border-box'
6970
}, getAllowedOverrides({height: true}));
7071

7172
const banner = style({

packages/dev/s2-docs/pages/react-aria/Checkbox.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function Example(props) {
6666

6767
## Forms
6868

69-
Use the `name` and `value` props to submit the checkbox to the server. Set the `isRequired` prop to validate the user selects the checkbox, or implement custom client or server-side validation. See the Forms guide to learn more.
69+
Use the `name` and `value` props to submit the checkbox to the server. Set the `isRequired` prop to validate the user selects the checkbox, or implement custom client or server-side validation. See the [Forms](forms) guide to learn more.
7070

7171
```tsx render
7272
"use client";

packages/dev/s2-docs/pages/react-aria/CheckboxGroup.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function Example() {
7676

7777
## Forms
7878

79-
Use the `name` prop to submit the selected checkboxes to the server. Set the `isRequired` prop on the `<CheckboxGroup>` to validate the user selects at least one checkbox, or on individual checkboxes. See the Forms guide to learn more.
79+
Use the `name` prop to submit the selected checkboxes to the server. Set the `isRequired` prop on the `<CheckboxGroup>` to validate the user selects at least one checkbox, or on individual checkboxes. See the [Forms](forms) guide to learn more.
8080

8181
```tsx render
8282
"use client";

packages/dev/s2-docs/pages/react-aria/ColorField.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function Example() {
105105

106106
## Forms
107107

108-
Use the `name` prop to submit the text value to the server. Set the `isRequired` prop to validate the value, or implement custom client or server-side validation. See the Forms guide to learn more.
108+
Use the `name` prop to submit the text value to the server. Set the `isRequired` prop to validate the value, or implement custom client or server-side validation. See the [Forms](forms) guide to learn more.
109109

110110
```tsx render
111111
"use client";

packages/dev/s2-docs/pages/react-aria/ComboBox.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ function Example() {
287287

288288
## Forms
289289

290-
Use the `name` prop to submit the `id` of the selected item to the server. Set the `isRequired` prop to validate that the user selects a value, or implement custom client or server-side validation. See the Forms guide to learn more.
290+
Use the `name` prop to submit the `id` of the selected item to the server. Set the `isRequired` prop to validate that the user selects a value, or implement custom client or server-side validation. See the [Forms](forms) guide to learn more.
291291

292292
```tsx render
293293
"use client";

0 commit comments

Comments
 (0)