Skip to content

🎨 Palette: Prevent Button layout shift on loading and enhance accessibility#215

Open
mknoufi wants to merge 1 commit into
mainfrom
palette/fix-button-layout-shift-and-a11y-13010360547956550027
Open

🎨 Palette: Prevent Button layout shift on loading and enhance accessibility#215
mknoufi wants to merge 1 commit into
mainfrom
palette/fix-button-layout-shift-and-a11y-13010360547956550027

Conversation

@mknoufi

@mknoufi mknoufi commented Jun 25, 2026

Copy link
Copy Markdown
Owner

User description

💡 What: Prevented Button layout shift during its loading state by preserving the text with opacity: 0 instead of unmounting it. Additionally, exposed accessibilityLabel and accessibilityHint while enforcing accessibilityRole="button" and accessibilityState.
🎯 Why: Layout shifts during loading cause jarring experiences and accidental misclicks. Icon-only buttons or those with custom labels were previously inaccessible to screen readers because TouchableOpacity was missing explicit roles and states.
♿ Accessibility:

  • Added explicit accessibilityRole="button".
  • Wired accessibilityLabel with a fallback to title.
  • Mapped accessibilityState={{ disabled: isDisabled, busy: loading }} to correctly announce the button's loading and disabled statuses.

PR created automatically by Jules for task 13010360547956550027 started by @mknoufi


CodeAnt-AI Description

Keep button size stable while it is loading and improve screen reader support

What Changed

  • Button text now stays in place during loading, so the button keeps the same size instead of jumping when the spinner appears
  • The loading spinner is shown on top of the text without changing the button layout
  • Button screen reader support now includes a clear button role, optional custom label and hint, and accurate disabled/loading status

Impact

✅ Fewer button layout jumps
✅ Reduced accidental misclicks during loading
✅ Clearer screen reader feedback for buttons

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Co-authored-by: mknoufi <209227354+mknoufi@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@codeant-ai

codeant-ai Bot commented Jun 25, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@codeant-ai

codeant-ai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Jun 25, 2026
@sonarqubecloud

Copy link
Copy Markdown

Comment on lines +107 to 109
{loading && (
<ActivityIndicator style={{ position: "absolute" }} color={colors.text} size="small" />
)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The loading spinner is absolutely positioned without centering constraints, so it will render at the container origin instead of the button center on loading. Add centering styles (for example full inset + centered alignment, or explicit top/left transform) so the indicator appears where the label was. [css layout issue]

Severity Level: Major ⚠️
- ❌ Database sync buttons show off-center spinner while loading.
- ⚠️ Users see janky layout during Test Connection actions.
- ⚠️ Inconsistent visual alignment across loading button states.
Steps of Reproduction ✅
1. Render the `DatabaseSyncStatus` component defined in
`frontend/src/components/DatabaseSyncStatus.tsx:30` so that the action buttons at lines
11–27 (e.g. "Test Connection", "Refresh Status") are visible.

2. Trigger `handleTestConnection` at
`frontend/src/components/DatabaseSyncStatus.tsx:33-43` (for example by tapping the "Test
Connection" button), which sets `loading` state `true` and passes it as the `loading` prop
to the `Button` instances at lines 11–18 and 20–27.

3. When `loading` is true, the shared `Button` component in
`frontend/src/components/ui/Button.tsx` renders the loading indicator at lines 107–109:
`{loading && (<ActivityIndicator style={{ position: "absolute" }} ... />)}` as a sibling
of the text container.

4. Because the `ActivityIndicator` only has `position: "absolute"` with no `top`, `left`,
or centering constraints, it is laid out from the parent `TouchableOpacity`'s origin
(top-left) instead of the visual center, so the spinner appears misaligned relative to the
button label position while loading.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** frontend/src/components/ui/Button.tsx
**Line:** 107:109
**Comment:**
	*Css Layout Issue: The loading spinner is absolutely positioned without centering constraints, so it will render at the container origin instead of the button center on loading. Add centering styles (for example full inset + centered alignment, or explicit top/left transform) so the indicator appears where the label was.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai

codeant-ai Bot commented Jun 25, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant