Page MenuHomePhabricator

prevent newlines in term fields
Closed, ResolvedPublic

Description

Problem
When in edit mode and entering a newline (return key on the keyboard), the behavior of the edit field is unclear.

Solution

  • a newline should not insert a line break
  • a newline will be ignored when entered in a focused edit field
  • when being copied in an edit field a newline will be replaced with an empty string.

Open question:
How will aliases separated by pipes be copied?
Would it be possible to replace line breaks in aliases by inserting pipes or actually insert line breaks (as aliases will be separated by something similar to a newline anyhow as stated in T218690)?

Event Timeline

Currently implemented in https://gerrit.wikimedia.org/r/plugins/gitiles/data-values/value-view/+/master/lib/jquery/jquery.inputautoexpand.js#212
The name (inputautoexpand) suggested that the same code also deals with what T220185 is trying to achieve.

Change 501590 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[wikibase/termbox@master] Term inputs: prevent newlines

https://gerrit.wikimedia.org/r/501590

@Hanna_Petruschat_WMDE Thank you for the very precise task definition. One question to be sure: the current wikidata termbox does not replace newlines with "a space" but with an empty string. Is this change in behavior intended?

@Pablo-WMDE
Nope. This is my missing ability to define this as needed in tech tongue (I was even googling a "correct" term and apparently didn't come across one)

Thanks, @Hanna_Petruschat_WMDE - fixed the description accordingly.

Change 501590 merged by jenkins-bot:
[wikibase/termbox@master] Term inputs: prevent newlines

https://gerrit.wikimedia.org/r/501590