whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
8.01k stars 2.62k forks source link

Add `twitter` for `<input>`'s `type` and global `inputmode` attributes? #4589

Open upsuper opened 5 years ago

upsuper commented 5 years ago

iOS's keyboard has a keyboard type twitter which means text with easy access to @ and #.

Nowadays @ and # are pretty much the de-facto way to mention people and add tag, so authors may want to be able to make use of this keyboard type. It would probably be good to provide this functionality to the web platform.

annevk commented 5 years ago

If we do this, I'd prefer a more generic name such as "social-text" as this also applies to various other products, e.g., GitHub and Slack.

upsuper commented 5 years ago

Yeah, I'm not proposing using the exact same name here, just the functionality.

keithamus commented 5 years ago

Just an idea, but what about abstracting this into something like a common-characters attribute which could be used at the browsers discretion to provide easy access to additional keys; <input type="text" common-characters="@,#"> might be useful for social networking sites, while <input type="number". common-characters="+,-,*,/,="> would be useful for a calculator.

annevk commented 5 years ago

@keithamus do various platform APIs support that kind of setup? I was assuming they do not, given the dedicated twitter type linked above.

keithamus commented 5 years ago

Yeah I imagine they don't, I'm mostly concerned that adding another input type which is just text with a different keyboard confuses the issue more. Even if browsers hooked off of fixed strings of common-characters there's still scope for extensibility.

annevk commented 5 years ago

I see, I don't think we should support this for type personally, only for inputmode, as it's about virtual keyboards only.

dtapuska commented 5 years ago

For inputmode we chose the intersection between what is supported on popular mobile platforms (Android and iOS). It is not possible to set a "twitter" keyboard on Android. There is a "short-text" type and I think we should try to understand how that behaves whether it provides the same functionality as the "twitter" keyboard on iOS.

Crissov commented 4 years ago

WhatsApp, Youtube, Slack and many more would benefit from some punctuation characters being directly accessible for formatting / markup:

Note, this is not enough for markdown, wiki, HTML, BBCode etc. LWL

jcayzac commented 3 years ago

I like the idea proposed in https://github.com/whatwg/html/issues/4589#issuecomment-489019845

Even if the UA doesn't support a VK layout with all the symbols requested, this can be used as a hint to select from the various available layouts. inputmode="text" easyaccess=":@#" for instance would result in the twitter VK being used in Mobile Safari.

Regarding the value of this new attribute, since it would be used as a hint, the positional order of each character could correspond to the priority of each character, so the :@# value above would prefer a layout that only exposes : and @ on its first/main view to a layout that only exposes @ and #, for example.

Crissov commented 3 years ago

I’d suggest message or comment – or perhaps text message or text-message if that improves backwards compatibility. Android’s short-message(as in SMS) would be okay, too.