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: Remove autofocus on dialog text input, reduce category image size #395

Merged
merged 2 commits into from
Apr 18, 2024

Conversation

skanderm
Copy link
Contributor

src={icon.src}
alt={`${title} icon`}
width={isDesktop ? 100 : 20}
height={isDesktop ? 100 : 20}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new Next.js Image component has some responsive support but I had some difficulties making it work with the fill setting, so I reverted to the legacy Image component with media queries. The icon and the category text were on top of each other, and without fill you need to specify the width/height anyway

Copy link
Member

Choose a reason for hiding this comment

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

What do you think about having multiple copies of each image and hiding/unhiding with display: none on different breakpoints?

I've been trying to stay away from useMediaQuery because it's JS based which has some downsides (biggest problem is layout shifts). In this case (inside a modal) it's not really an issue but don't want to encourage the pattern. Unless there's a better solution I don't know of?

Copy link
Member

Choose a reason for hiding this comment

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

And yeah legacy Image isn't ideal, but we are using it elsewhere. It may get removed soon since it's been deprecated, so we'll be forced to figure it out at that point… but I guess it buys us some time

@paulcretu paulcretu temporarily deployed to orcasite-pr-395 April 11, 2024 00:38 Inactive
@skanderm
Copy link
Contributor Author

@Filadora Does this address the issue? Wondering whether the buttons being too small might affect UX for category selection. The simpler fix just removes autoFocus (which was opening the keyboard right away).

@Filadora
Copy link

@skanderm this is great! I think smaller buttons will simplify user experience since users won’t need to scroll and will be able to see all the buttons even when the keyboard is opened. I’ll make notes to get user feedback for this improvement during the next round of testing. And thank you for removing the autofocus (fixing the keyboard pop up).

paulcretu
paulcretu previously approved these changes Apr 16, 2024
ui/src/components/Player/DetectionCategoryButton.tsx Outdated Show resolved Hide resolved
src={icon.src}
alt={`${title} icon`}
width={isDesktop ? 100 : 20}
height={isDesktop ? 100 : 20}
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about having multiple copies of each image and hiding/unhiding with display: none on different breakpoints?

I've been trying to stay away from useMediaQuery because it's JS based which has some downsides (biggest problem is layout shifts). In this case (inside a modal) it's not really an issue but don't want to encourage the pattern. Unless there's a better solution I don't know of?

src={icon.src}
alt={`${title} icon`}
width={isDesktop ? 100 : 20}
height={isDesktop ? 100 : 20}
Copy link
Member

Choose a reason for hiding this comment

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

And yeah legacy Image isn't ideal, but we are using it elsewhere. It may get removed soon since it's been deprecated, so we'll be forced to figure it out at that point… but I guess it buys us some time

@skanderm skanderm enabled auto-merge (squash) April 17, 2024 18:21
@skanderm skanderm temporarily deployed to orcasite-pr-395 April 17, 2024 18:42 Inactive
Copy link
Member

@paulcretu paulcretu left a comment

Choose a reason for hiding this comment

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

Testing this out on narrow screens, just caught that it doesn't display nicely on widths less than ~370px or so.

image

I've been trying to keep it nice down to 320px, not sure if it's necessary but it's a good design system discussion. We should set some design guidelines.

Anyway @skanderm I'm approving, I think fixing the autofocus is more important than 320px wide screens (and it does scroll overflow so it's not unusable)

@skanderm skanderm merged commit 97afb72 into main Apr 18, 2024
4 checks passed
@skanderm skanderm deleted the skander/fix-mobile-dialog branch April 18, 2024 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keyboard pop up on mobile when reporting the sound
3 participants