Repository navigation
Conversation
|
We've got conflicts @likevy |
ea20e26 to
b200183
Compare
There was a problem hiding this comment.
Review by Claude
The PR description no longer matches the code. It still says surface is added, hover elevation is web only, the menu trigger does not rise, and an explicit shell elevation is kept. The second commit changed all four. Please update it so the description matches what ships. (via Claude, verify if it makes sense)
| // Branded artwork has no prescribed icon color; onSurface is a fallback. | ||
| branded: { container: 'surfaceContainerHigh', content: 'onSurface' }, |
There was a problem hiding this comment.
The earlier question about whether branded is in the official guidelines has no answer yet, and the variant is still here. branded comes from material-web's md-branded-fab, which is meant for multicolor brand logos and has no icon color token, so onSurface here is a guess.
It also costs API surface. FAB.Menu needs a separate MenuVariant type to exclude it, and the example needs a chip filter, a reset on type switch and a ternary at the trigger. I suggest you remove branded and MenuVariant. Apps that want this look can pass containerColor={colors.surfaceContainerHigh}. (via Claude, verify if it makes sense)
| If you omit `variant`, no change is needed. Replace `variant="surface"` with | ||
| one of the supported color variants, such as `primaryContainer`. |
There was a problem hiding this comment.
primaryContainer does not keep the v5 look. In v5, surface used elevation.level3 for the container and primary for the icon. The closest v6 roles are surfaceContainerHigh and primary, so the guide can show that instead:
| If you omit `variant`, no change is needed. Replace `variant="surface"` with | |
| one of the supported color variants, such as `primaryContainer`. | |
| If you omit `variant`, no change is needed. The `surface` variant was removed. To keep its look, pass the colors directly: | |
| ```js | |
| const { colors } = useTheme(); | |
| <FAB | |
| icon="plus" | |
| containerColor={colors.surfaceContainerHigh} | |
| contentColor={colors.primary} | |
| /> | |
| ``` |
(via Claude, verify if it makes sense)
|
|
||
| React.useEffect(() => { | ||
| if (!visible) { | ||
| if (Platform.OS === 'web' && typeof document !== 'undefined') { |
There was a problem hiding this comment.
The typeof document check never fails here. Effects do not run during server rendering, and on web document exists. The extra check makes it look like a case the code has to handle.
| if (Platform.OS === 'web' && typeof document !== 'undefined') { | |
| if (Platform.OS === 'web') { |
(via Claude, verify if it makes sense)
satya164
left a comment
There was a problem hiding this comment.
Review by Claude
See the inline comments. (via Claude, verify if it makes sense)
| @@ -214,7 +228,7 @@ const FABExample = () => { | |||
| alignment={position} | |||
| trigger={{ | |||
| icon: 'pencil', | |||
There was a problem hiding this comment.
The menu trigger is also an icon-only FAB, but it has no aria-label. With Type set to menu, the trigger shows up in the iOS accessibility tree as a button with no label, and on web its <button> has no accessible name. The icon FAB got aria-label="Compose" in this PR, so the trigger can get one too:
| icon: 'pencil', | |
| icon: 'pencil', | |
| 'aria-label': 'Compose', |
(via Claude, verify if it makes sense)
Add surface and branded variants, apply web hover elevation, and prevent hidden FABs from retaining focus or actions. Keep large icons at 36dp. BREAKING CHANGE: Replace tonalPrimary, tonalSecondary, and tonalTertiary with primaryContainer, secondaryContainer, and tertiaryContainer. The old variant names are removed without aliases.
Remove the surface preset and static elevation override. Apply hover elevation across platforms and restore focus when hiding a focused FAB. Separate hidden and disabled semantics, and rewrite the migration guide around v5 consumer changes.
The branded FAB comes from material-web's md-branded-fab, which is meant for multicolor brand logos and has no icon color token, so it is not one of the MD3 FAB color styles. Removing it also removes the menu-only variant type and the example's special cases for it.
primaryContainer does not match the v5 surface variant, which used a surface container with a primary icon. Point to containerColor and contentColor with the closest v6 roles instead.
Effects do not run during server rendering and document always exists on web, so the check never fails.
The menu trigger is an icon-only FAB, so without a label it is announced as an unnamed button.
Align the variant table and wrap the surface example in a component so it is self-contained and prettier keeps it as written.
Browsers also focus the FAB on a mouse click or tap, so moving focus back to the previous element when it hides could jump into an earlier text field. Check :focus-visible at hide time and blur in the other cases.
userEvent.press is already blocked by pointerEvents none, so the test passed without the guard. A click event still reaches the pressable and fails the test when the guard is removed.
Cover moving focus back after keyboard focus, blurring instead when the previous element is hidden, inert or disconnected or when the FAB was focused by a mouse click, and leaving focus alone when the FAB no longer has it.
Compare the FAB's own style between hover, focus and press states instead of asserting the Surface shadow tokens, and describe the iOS and Android cases by what they check, since React Native 0.85 sends no hover events there by default.
MD3 keeps a focused FAB at level 3. Without this step, folding focus into the hover state would still pass the elevation tests.
The state comparisons only checked that hover changes the style. Android exposes elevation as a number, so assert there that hover raises it and pressing lowers it, and title the web test by what it checks.
The element stub always took focus, so nothing checked the blur after a restore attempt that the browser ignores. Make focus() a no-op on disconnected or unfocusable elements, as browsers do, and cover that case.
Apps using React Navigation also have a useTheme whose colors lack surfaceContainerHigh, so make the source explicit.
b200183 to
55b9ea9
Compare
Motivation
FAB presets didn't use MD3 role names and hover elevation was unused.
tonalPrimaryis nowprimaryContainer, same for secondary and tertiary.Related issue
FAB review checklist.
Screenshots / Videos
Test plan
In the FAB example: