Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC][fields] HTML structure of the input #10699

Closed
flaviendelangle opened this issue Oct 17, 2023 · 2 comments · Fixed by #10649
Closed

[RFC][fields] HTML structure of the input #10699

flaviendelangle opened this issue Oct 17, 2023 · 2 comments · Fixed by #10649
Labels
component: pickers This is the name of the generic UI component, not the React module! feature: Keyboard editing Related to the pickers keyboard edition RFC Request For Comments

Comments

@flaviendelangle
Copy link
Member

flaviendelangle commented Oct 17, 2023

Current structure

The field currently has a single HTML <input /> tag that contains the whole value (the whole date for DateField / TimeField .... and the whole date range for SingleInputDateRangeField, ...)

The limitation on accessibility are forcing us to consider other approaches and the resulting trade-offs

Possible structures

One <input />

  <input value="MM/DD/YYYY" />
  • 👎 Poor accessibility

  • 👎 A lot of very custom JS behavior to handle our section-based editing

  • 👎 The value in the input is not exactly the expect one (can have RTL UTF-8 characters or the one for no leading-zero)

One <input /> per section

<div>
  <input value="MM" />
  <span>/</span>
  <input value="DD" />
  <span>/</span>
  <input value="YYYY" />
  <input type="hidden" value="MM/DD/YYYY" />
</div>
  • 👎 Can't benefit from customization of TextField (people that want to customize all their input throughout their application would have to re-do the customization on our fake textfield)

  • 👎 Can't select the whole value to copy / paste (to be checked more thoroughly)

One <span /> per section with contenteditable={true}

After looking at the examples on MDN, not sure this brings any major benefit, but to be tested.

<div>
  <span contenteditable={true}>MM</span>
  <span>/</span>
  <span contenteditable={true}>DD</span>
  <span>/</span>
 <span contenteditable={true}>YYYY</span>
 <input type="hidden" value="MM/DD/YYYY" />
</div>
  • 👎 Can't benefit from customization of TextField (people that want to customize all their input throughout their application would have to re-do the customization on our fake textfield)

  • 👎 Can't select the whole value to copy / paste (to be checked more thoroughly)

@flaviendelangle flaviendelangle added status: waiting for maintainer These issues haven't been looked at yet by a maintainer RFC Request For Comments component: pickers This is the name of the generic UI component, not the React module! feature: Keyboard editing Related to the pickers keyboard edition and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 17, 2023
@flaviendelangle
Copy link
Member Author

Closes by #10649

Copy link

github-actions bot commented Mar 1, 2024

⚠️ This issue has been closed.
If you have a similar problem, please open a new issue and provide details about your specific problem.
If you can provide additional information related to this topic that could help future readers, please feel free to leave a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! feature: Keyboard editing Related to the pickers keyboard edition RFC Request For Comments
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant