Skip to content
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

fix(snaps): Keep focus on input if interface re-renders #27429

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

GuillaumeRx
Copy link
Contributor

@GuillaumeRx GuillaumeRx commented Sep 26, 2024

Description

This PR adds a reference to the currently focused input in a snap interface and set the focus back to the last focused input if the interface re-renders.

This fixes a problem where it will loose input focus and set it to the last input of the interface if an interface was re-rendered.

Open in GitHub Codespaces

Related issues

Fixes: #27424

Manual testing steps

  1. Go to test-snaps
  2. Use the send flow example snap
  3. Try typing something in the "To address" field
  4. The focus should stay on your input.

Screenshots/Recordings

Before

2024-09-26-17-30-23.mp4

After

2024-09-26-17-27-26.mp4

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@GuillaumeRx GuillaumeRx requested a review from a team as a code owner September 26, 2024 15:33
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@github-actions github-actions bot added the team-snaps-platform Snaps Platform team label Sep 26, 2024
@GuillaumeRx GuillaumeRx changed the title fix(snaps):Keep focus on input if interface re-renders fix(snaps): Keep focus on input if interface re-renders Sep 26, 2024
Copy link

sonarcloud bot commented Sep 27, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@metamaskbot
Copy link
Collaborator

Builds ready [d667658]
Page Load Metrics (1669 ± 80 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint15062313167116177
domContentLoaded14982196164514168
load15062336166916780
domInteractive17183503617
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 249 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link
Member

@FrederikBolding FrederikBolding left a comment

Choose a reason for hiding this comment

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

Awesome 🔥

@GuillaumeRx GuillaumeRx merged commit 7fa5286 into develop Oct 1, 2024
76 of 77 checks passed
@GuillaumeRx GuillaumeRx deleted the gr/keep-input-focus branch October 1, 2024 10:28
@github-actions github-actions bot locked and limited conversation to collaborators Oct 1, 2024
@metamaskbot metamaskbot added the release-12.6.0 Issue or pull request that will be included in release 12.6.0 label Oct 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.6.0 Issue or pull request that will be included in release 12.6.0 team-snaps-platform Snaps Platform team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix input loosing focus in Custom UI
4 participants