Page MenuHomePhabricator

TextArea: Add `fixedHeight` and `autosize` props
Closed, ResolvedPublic

Description

This task covers adding the fixedHeight and autosize props and their associated functionality.

Design spec

Acceptance criteria

Update: we decided not to implement fixedHeight for accessibility reasons (to ensure the user has a way of expanding the textarea) and only implemented autosize.

  • The "grabber" that allows for manually resizing displays by default
  • A boolean prop called fixedHeight has been added. When set to true, the grabber will not be displayed and the height of the <textarea> will not change.
  • A boolean prop called autosize has been added. When set to true, the grabber will not be displayed and the height of the <textarea> will grow as more text is added
  • When fixedHeight and autosize are set to true, the autosize prop will override the fixedHeight.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 916507 had a related patch set uploaded (by LWatson; author: LWatson):

[design/codex@main] TextArea: Add fixedHeight and autosize props

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

Hey @bmartinezcalvo - during the Engineering Enclave, Volker brought up a good point that the text area with a fixed height may be an a11y antipattern. The text area with fixed height doesn't have a grabber which disables the user from resizing the text area. This is accomplished in CSS with resize: none; which is not supported by all browsers (specifically not supported by Safari iOS).

This article goes into more detail on why resize: none; is not recommended for UX and suggests allowing the user to resize the text area at least vertically with resize: vertical;.

For now, we've decided to remove fixedHeight from the current patch 916507.

Please let me know your thoughts and use cases for fixed height.

Thanks!

Restricted Application triaged this task as High priority. · View Herald TranscriptMay 16 2023, 2:45 PM
lwatson changed the task status from Open to In Progress.May 16 2023, 2:46 PM
lwatson removed a project: Patch-For-Review.

Change 916507 merged by jenkins-bot:

[design/codex@main] TextArea: Add fixedHeight and autosize props

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

From the engineering enclave meeting this week, I raised doubts about disabling resize on TextArea in general. I think it's a usability/an accessibility anti-pattern we should not deliver in Codex out-of-box.
https://catalin.red/css-resize-none-is-bad-for-ux/ for an (older) alternate solution on using contenteditable="true".

AnneT added a subscriber: lwatson.

Moving this to design review so we can decide what to do about fixedHeight

I found a use case where the Text Area is fixed height. It's this use case from Growth where the user needs to write a short description about the image. @RHo do we really need this Text Area to be fixed height or could it be replaced with the grabber version?

F37008632

Another use case I can find now with fixed height is this from Wikipedia > Add topic, but this is not a Text Area but a Text Editor instead.

Captura de pantalla 2023-05-18 a las 11.13.18.png (576×2 px, 71 KB)

Also, I found text areas with fixed height in other DS (such as the Atlassian Design System).

Moving to Design Review to take a decision on the fixed height.

Here's an example of a form that has a textarea with a grabber to expand the size vertically only

I found a use case where the Text Area is fixed height. It's this use case from Growth where the user needs to write a short description about the image. @RHo do we really need this Text Area to be fixed height or could it be replaced with the grabber version?
F37008632

This isn't fixed height, but merely uses a default value for row height (3 rows) and uses the "autosize" version of the OOUI multiline text component and extends if the input is longer than the default.

Another use case I can find now with fixed height is this from Wikipedia > Add topic, but this is not a Text Area but a Text Editor instead.

Captura de pantalla 2023-05-18 a las 11.13.18.png (576×2 px, 71 KB)

Also, I found text areas with fixed height in other DS (such as the Atlassian Design System).

Change 922610 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/core@master] Update Codex from v0.10.0 to v0.11.0

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

Change 922610 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v0.10.0 to v0.11.0

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

During the last Eng/Design sync we take the decision of removing the fixedHeight prop. We will only have an autosize prop. The grabber will appear when autosize=false, and will not appear when autosize=true.

@lwatson I've updated the Figma spec sheet to reflect this decision.

@bmartinezcalvo the updates in the design spec look great, thanks!

Change 923416 had a related patch set uploaded (by LWatson; author: LWatson):

[design/codex@main] TextArea: Refactor autosize

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

Change 923416 merged by jenkins-bot:

[design/codex@main] TextArea: Refactor autosize

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

AnneT removed a project: Patch-For-Review.
AnneT updated the task description. (Show Details)

Change 927786 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/core@master] Update Codex from v0.11.0 to v0.12.0

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

Test wiki created on Patch demo by ATomasevich (WMF) using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/8ca78d2715/w

Change 927786 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v0.11.0 to v0.12.0

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

Test wiki on Patch demo by ATomasevich (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/8ca78d2715/w/