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

Force canvas/text input focus on touch for iOS web browsers #4848

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

BKSalman
Copy link
Contributor

@BKSalman BKSalman commented Jul 18, 2024

Related to #4569

  • moved is_mobile from eframe/src/web/text_agent.rs to eframe/src/web/mod.rs and used it in eframe/src/web/events.rs
  • added event listener for pointerdown event
  • added event listener for pointerup event and forced the canvas to be focused when the event is received and therefore the on-screen keyboard appearing

This PR tries to fix iOS browsers issue where it doesn't focus the canvas/text input on touch and therefore not showing the on-screen keyboard. It does it by force focusing the canvas on pointerup

@BKSalman BKSalman marked this pull request as draft July 18, 2024 22:49
@BKSalman BKSalman changed the title Fix canvas/text input focus on iOS web browsers Force canvas/text input focus on touch for iOS web browsers Jul 19, 2024
@cyypherus
Copy link

This is a big step forward for egui mobile web, ty

@BKSalman BKSalman marked this pull request as ready for review July 20, 2024 08:33
@jprochazk jprochazk added web Related to running Egui on the web eframe Relates to epi and eframe iOS labels Jul 22, 2024
@jprochazk jprochazk self-requested a review July 22, 2024 19:05
Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

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

I tested it on iOS and it definitely helps #4569, but does not completely fix it. Still a step in the right direction ⭐

@jprochazk jprochazk merged commit 34db001 into emilk:master Jul 23, 2024
19 checks passed
@BKSalman BKSalman deleted the fix-ios-canvas-focus branch July 23, 2024 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
eframe Relates to epi and eframe iOS web Related to running Egui on the web
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants