Open Bug 1655591 Opened 4 years ago Updated 2 months ago

Text selection does not snap to phone number or email

Categories

(Core :: Layout, defect)

Unspecified
All
defect

Tracking

()

People

(Reporter: sblatz, Unassigned)

References

(Blocks 1 open bug)

Details

There are often extraneous spaces and characters like "." included when the tapping and holding on a phone number or email address. See fenix issue: https://github.com/mozilla-mobile/fenix/issues/10260#issuecomment-664239349

Component: General → DOM: Selection
Product: GeckoView → Core

This sounds a very common and convenient feature on phone.
Hi Kagami, can you help take a look at what's up here? Thanks!

Flags: needinfo?(krosylight)

The Fenix behavior is vastly different from the common Gecko behavior.

  1. "000 000 0000": Gecko always stops on a whitespace but somehow Fenix continues selection. There is no way to do this on desktop unless I missed something important.
  2. "000-000-0000": Gecko by default stops on - but Fenix somehow does not. This is controlled by a flag layout.word_select.stop_at_underscore but I don't see any line that disables it on Android.

So my immediate guess is that the Fenix behavior is from Fenix.

Flags: needinfo?(krosylight)

The relevant code is in Gecko, see this.

It seems like the relevant code and AccessibleCaretManager::IsPhoneNumber could be a bit smarter.

Thanks Emilio, TIL what AccessibleCaret does! Can I enable and test it on Windows? layout.accessiblecaret.enabled is not helpful somehow.

Ah okay, did it. Thanks!

I'm not assigning myself for now, feel free to take this if someone is working on AccessibleCaret.

Component: DOM: Selection → Layout

Should there be a new category "Layout: Selection", as I think DOM: Selection is more about Selection API? What do you think?

Or maybe rename the existing category as the description and the actual bugs in it doesn't really match.

It seems TYLin made most of the AccessibleCaret work, maybe he has cycles to fix this?

NI myself as a reminder.

Flags: needinfo?(aethanyc)
Severity: -- → S3

(In reply to Emilio Cobos Álvarez (:emilio) from comment #4)

It seems like the relevant code and AccessibleCaretManager::IsPhoneNumber could be a bit smarter.

The phone number format varies from country to country. The common pattern in North American can be the following:

  • 123 456 7890
  • (123) 456 7890
  • 123-456-7890
  • 123.456.7890

We can improve the phone number selection if we can find a better regex to match the above. Country code like +1 and extension may also be considered, but they are less common.

Clear the NI since I don't have a plan to work on this at the moment.

Flags: needinfo?(aethanyc)
You need to log in before you can comment on or make changes to this bug.