-
Notifications
You must be signed in to change notification settings - Fork 23
[UX] Mobile Home Screen Skeleton Loading #291
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
Open
Devasy
wants to merge
1
commit into
main
Choose a base branch
from
jules/ux-mobile-home-skeleton-1918836578316525257
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import React from 'react'; | ||
| import { View, StyleSheet } from 'react-native'; | ||
| import { Card } from 'react-native-paper'; | ||
| import Skeleton from '../ui/Skeleton'; | ||
|
|
||
| const GroupListSkeleton = () => { | ||
| // Render 5 items to fill the screen | ||
| const items = Array.from({ length: 5 }, (_, i) => i); | ||
|
|
||
| return ( | ||
| <View style={styles.container} accessible={true} accessibilityLabel="Loading groups"> | ||
| {items.map((key) => ( | ||
| <Card key={key} style={styles.card}> | ||
| <Card.Title | ||
| title={<Skeleton width={150} height={20} />} | ||
| left={(props) => ( | ||
| <Skeleton width={40} height={40} borderRadius={20} /> | ||
| )} | ||
| /> | ||
| <Card.Content> | ||
| <Skeleton width={200} height={16} style={{ marginTop: 4 }} /> | ||
| </Card.Content> | ||
| </Card> | ||
| ))} | ||
| </View> | ||
| ); | ||
| }; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| container: { | ||
| padding: 16, | ||
| }, | ||
| card: { | ||
| marginBottom: 16, | ||
| }, | ||
| }); | ||
|
|
||
| export default GroupListSkeleton; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import React, { useEffect, useRef } from 'react'; | ||
| import { Animated, View, StyleSheet } from 'react-native'; | ||
| import { useTheme } from 'react-native-paper'; | ||
|
|
||
| const Skeleton = ({ width, height, borderRadius = 4, style }) => { | ||
| const theme = useTheme(); | ||
| const opacity = useRef(new Animated.Value(0.3)).current; | ||
|
|
||
| useEffect(() => { | ||
| const animation = Animated.loop( | ||
| Animated.sequence([ | ||
| Animated.timing(opacity, { | ||
| toValue: 1, | ||
| duration: 1000, | ||
| useNativeDriver: true, | ||
| }), | ||
| Animated.timing(opacity, { | ||
| toValue: 0.3, | ||
| duration: 1000, | ||
| useNativeDriver: true, | ||
| }), | ||
| ]) | ||
| ); | ||
| animation.start(); | ||
|
|
||
| return () => animation.stop(); | ||
| }, [opacity]); | ||
|
|
||
| return ( | ||
| <Animated.View | ||
| style={[ | ||
| { | ||
| opacity, | ||
| width, | ||
| height, | ||
| borderRadius, | ||
| backgroundColor: theme.colors.surfaceVariant, | ||
| }, | ||
| style, | ||
| ]} | ||
| accessibilityRole="progressbar" | ||
| accessibilityLabel="Loading..." | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export default Skeleton; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
🏁 Script executed:
find mobile -name "Skeleton.js" -type fRepository: Devasy/splitwiser
Length of output: 93
🏁 Script executed:
Repository: Devasy/splitwiser
Length of output: 1476
🏁 Script executed:
Repository: Devasy/splitwiser
Length of output: 142
🏁 Script executed:
Repository: Devasy/splitwiser
Length of output: 1315
🌐 Web query:
React Native accessible={false} importantForAccessibility="no" accessibilityElementsHidden💡 Result:
accessible={false}: only means the View itself is not treated as a single “accessibility element” (iOS:isAccessibilityElement, Android:focusable). It does not automatically remove the view (or its children) from the screen reader’s accessibility tree. [1]importantForAccessibility="no"(Android): tells Android accessibility services the view itself is not important (won’t be reported), but it does not hide descendants. To hide a view and all children on Android, useimportantForAccessibility="no-hide-descendants". [1][2]accessibilityElementsHidden(iOS): whentrue, hides the view and any accessibility elements it contains from VoiceOver. This is essentially the iOS equivalent of Android’simportantForAccessibility="no-hide-descendants". [1][2]Practical mapping (hide subtree from screen readers)
Using
accessible={false}and/orimportantForAccessibility="no"is not sufficient if your goal is “screen reader should ignore this whole section.” [1][2]Sources: React Native Accessibility docs [1]; React Native Testing Library notes on what actually makes elements inaccessible [2].
🌐 Web query:
React Native accessibility best practices skeleton loading screen reader announcement💡 Result:
Best practices (React Native) for an accessible skeleton loading state + screen reader announcement
Don’t expose the skeleton UI to screen readers
Expose a single “loading” state on the real content container
accessibilityState={{ busy: true }}while loading, thenbusy: falsewhen done. (RN supportsbusyinaccessibilityState.) [1]accessibilityRole="progressbar"(or a status-like pattern) andaccessibilityLabel="Loading results"so the purpose is clear. [1], [2]Announce loading changes via “live region” where possible (Android)
accessibilityLiveRegion="polite"/"assertive"to announce updates when text changes. Prefer polite for loading. [1]accessibilityLiveRegionis Android-focused and has had consistency gaps across platforms. [9]Use direct announcements sparingly
AccessibilityInfo.announceForAccessibility(...)exists, but some platform docs caution against relying on forced announcements and recommend semantic/live-region approaches where possible. [2]Minimal pattern (container announces; skeleton hidden)
Key idea: one clear, non-spammy loading message/state on the container (
busy+ label / live update), while keeping skeleton visuals out of the accessibility tree. [1], [4], [7]Remove individual accessibility announcements from decorative skeletons.
Each skeleton element exposes itself as a progressbar with "Loading..." label. With ~15 skeleton elements across the list (5 cards × 3 skeletons each), this creates excessive screen reader noise. The container already provides a single "Loading groups" announcement, which is sufficient.
Remove the accessibility role and label from individual skeletons since they are decorative placeholders:
🔧 Suggested adjustment
<Animated.View style={[ { opacity, width, height, borderRadius, backgroundColor: theme.colors.surfaceVariant, }, style, ]} - accessibilityRole="progressbar" - accessibilityLabel="Loading..." + importantForAccessibility="no-hide-descendants" + accessibilityElementsHidden={true} />Note: If simply removing the role/label is preferred, use both props above for proper cross-platform support (Android + iOS).
🤖 Prompt for AI Agents