w3c / input-events

Input Events
https://w3c.github.io/input-events/
Other
23 stars 16 forks source link

There should be a way to distinguish between left-justifying content and left-aligning content #68

Closed whsieh closed 6 years ago

whsieh commented 6 years ago

On the newer touch bar MacBooks, there is UI for formatting rich text to be left-aligned, center-aligned, right-aligned, and justified; these apply text-align: {left|center|right|align} styles to the current selection. The current spec (link: https://w3c.github.io/input-events/index.html) enumerates "formatJustifyCenter", "formatJustifyRight" and "formatJustifyLeft" input types.

Is there any way in the current input events spec to distinguish between selecting a formatting option that justifies text, versus a formatting option that left-aligns text without justifying? It seems like we might benefit from having "formatAlign{Left|Center|Right}" input types, and a "formatJustify" input type for UI that just applies justified format (respecting LTR/RTL text direction).

touch-bar-formatting-options

(corresponding WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=168669)

whsieh commented 6 years ago

@choniong @johanneswilm

johanneswilm commented 6 years ago

Also in this case I believe it is something only Safari has and it can therefore still be changed. I will update the draft spec later today and I will put it on the agenda for the next call, so we can reverse the change in case it is being used somewhere else by now.

johanneswilm commented 6 years ago

Or does Chrome's touchbar support also include support for the text formatting operations by now? In that case it will be more difficult to fix any of the types that were Safari-only until now. @choniong @whsieh

johanneswilm commented 6 years ago

@whsieh I have tested Chrome and Safari on Mac OS X, and it looks like Chrome doesn't use the touchbar for operations related to contenteditable nor input, nor can I find any keyboard shortcuts to do so.

On Safari, the block-justify button emits an "formatJustifyLeft" beforeinput event, and that is clearly incorrect. Also, it looks like that button stays highlighted if the caret is inside justified content, which probably creates an entirely new category of issues because the highlighting will probably not work if the JS editor uses different markup to make the text be block justified.

As for naming: On various pages on the net I find "left justify" described as being synonymous with "left align" or "flush left" [1]. The term we have chosen here is maybe not the most common, but it seems to be correct. @whsieh Is ti really necessary to change the vocabulary for left and right justify, or would it be enough to add a "formatJustifyFull"?

[1] http://www.webopedia.com/TERM/L/left_justify.html [2] https://www.collinsdictionary.com/dictionary/english/left-justify

whsieh commented 6 years ago

@johanneswilm I see — if "{left|center|right} justification" is synonymous with "{left|center|right} alignment" in most contexts, then adding a new formatJustifyFull input type and having the justification formatting button (the rightmost button on the touch bar) emit this new input type sounds good to me.

johanneswilm commented 6 years ago

Perfect. Thatwe can just add as it won't affect anything else.

johanneswilm commented 6 years ago

approved by today's editing taskforce call, fixed in https://github.com/w3c/input-events/commit/95b1b4802a1967ef14b9aff1a0fa005c7857015d

johanneswilm commented 6 years ago

level 1 fix in https://github.com/w3c/input-events/commit/88bb8ac3ca2f67437a81cd8ac65771fadb92040d