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

Don't force the user out of touch mode. #167

Merged
merged 3 commits into from
May 23, 2021
Merged

Don't force the user out of touch mode. #167

merged 3 commits into from
May 23, 2021

Conversation

zhanghai
Copy link
Contributor

@zhanghai zhanghai commented May 22, 2021

First time contributor checklist

Contributor checklist

  • Virtual device: Pixel 2, Android 11.0. The sample app no longer forces user out of touch mode when user is touching the screen (in touch mode), and correctly focuses and highlights the first FAB when using keyboard (already out of touch mode).
  • My contribution is fully baked and ready to be merged as is
  • I ensure that all the open issues my contribution fixes are mentioned in the commit message of my first commit
    using the Fixes #1234 syntax

Description

Commit b9f48b2 made the SpeedDialView call requestFocusFromTouch() for
the first FAB upon toggle(). However, requestFocusFromTouch() will
force the user out of touch mode and the direct impact on UI is that
the first FAB gains a focused effect and stands out from other FABs.

This isn't the desired behavior because buttons, unlike text fields,
should never gain focus in touch mode, and this is unexpected for most
users (without a keyboard/trackball), both the behavior and the
look-and-feel. The official guidance on touch mode can be found at
https://android-developers.googleblog.com/2008/12/touch-mode.html ,
and the tl;dr is that "Do not try to keep the focus or selection in
touch mode", plus the implied don't force users out of touch mode as
users only enter touch mode when they start to use a keyboard or
trackball. If the user is already using a keyboard or trackball, then
they won't be in touch mode and the regular requestFocus() will just
work for them. This is also consistent with the speed dial
implementation that can be found in Google apps and I assume that they
have proper a11y support.

leinardi and others added 3 commits October 7, 2019 17:27
Prepare for release 3.1.1
Commit b9f48b2 made the SpeedDialView call requestFocusFromTouch() for
the first FAB upon toggle(). However, requestFocusFromTouch() will
force the user out of touch mode and the direct impact on UI is that
the first FAB gains a focused effect and stands out from other FABs.

This isn't the desired behavior because buttons, unlike text fields,
should never gain focus in touch mode, and this is unexpected for most
users (without a keyboard/trackball), both the behavior and the
look-and-feel. The official guidance on touch mode can be found at
https://android-developers.googleblog.com/2008/12/touch-mode.html ,
and the tl;dr is that "Do not try to keep the focus or selection in
touch mode", plus the implied don't force users out of touch mode as
users only enter touch mode when they start to use a keyboard or
trackball. If the user is already using a keyboard or trackball, then
they won't be in touch mode and the regular requestFocus() will just
work for them. This is also consistent with the speed dial
implementation that can be found in Google apps and I assume that they
have proper a11y support.
@leinardi
Copy link
Owner

Hi @zhanghai, thank you for this bugfix! It will be out with the next release. I would like to wait a little to see if there are other bugfix needed for 3.2.0. Is it OK for you if I make a new release next weekend?

@leinardi leinardi changed the base branch from release to master May 23, 2021 08:08
@leinardi leinardi merged commit 778c3fa into leinardi:master May 23, 2021
@zhanghai
Copy link
Contributor Author

Sounds good, and thank you for this awesome library!

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.

None yet

2 participants