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

ToggleSwitch: fix toggle on single touch tap on the knob part #12520

Merged
merged 1 commit into from
Aug 29, 2023

Conversation

msneijders
Copy link
Contributor

@msneijders msneijders commented Aug 11, 2023

What does the pull request do?

Fixing issue #12519 .

What is the current behavior?

Now tapping on the knob toggles the switch twice, returning the Checked to its original state.
On desktop: if you put mouse pointer above the knob (of an already focussed ToggleSwitch!), toggling using keyboard does not work.

What is the updated/expected behavior with this PR?

  • A single tap using touch device on the knob part of the ToggleSwitch should now toggle only once, instead of twice.
  • On desktop, if you position the mouse pointer exactly above the knob of a focussed ToggleSwitch, the toggle now works using keyboard space to toggle.

Breaking changes

None

Fixed issues

Fixes #12519

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0038410-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@Mrxx99
Copy link
Sponsor Contributor

Mrxx99 commented Aug 12, 2023

On desktop, if you position the mouse pointer exactly above the knob, the toggle now works using keyboard space to toggle.

Should this not only happen if the control has keyboard focus? Do other UI frameworks do this?

@msneijders
Copy link
Contributor Author

On desktop, if you position the mouse pointer exactly above the knob, the toggle now works using keyboard space to toggle.

Should this not only happen if the control has keyboard focus? Do other UI frameworks do this?

Certainly -- on desktop if you focus the ToggleSwitch first (using tab, or mouse click) -- then you should be able to toggle it using keyboard space. But this does currently not work when your mouse pointer is exactly above the knob.

@Mrxx99
Copy link
Sponsor Contributor

Mrxx99 commented Aug 12, 2023

Certainly -- on desktop if you focus the ToggleSwitch first (using tab, or mouse click) -- then you should be able to toggle it using keyboard space. But this does currently not work when your mouse pointer is exactly above the knob.

Agree, first understood it should toggle even without keyboard focus but mouse above toggle, sorry

@maxkatz6 maxkatz6 added this pull request to the merge queue Aug 29, 2023
Merged via the queue into AvaloniaUI:master with commit 8698418 Aug 29, 2023
6 checks passed
@grokys grokys added the backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch label Oct 2, 2023
grokys pushed a commit that referenced this pull request Oct 2, 2023
ToggleSwitch: fix toggle on single touch tap on the knob part
@grokys grokys added backported-11.0.x and removed backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ToggleSwitch toggles twice when tapping knob using touch device
5 participants