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

feat: Slots for prefix and suffix in components #502

Open
3 tasks done
simberman-gc opened this issue Apr 16, 2024 · 2 comments
Open
3 tasks done

feat: Slots for prefix and suffix in components #502

simberman-gc opened this issue Apr 16, 2024 · 2 comments
Labels
development Development tasks enhancement New feature or request

Comments

@simberman-gc
Copy link

Prerequisites

Describe the feature request.

We would like to be able to put explanatory text directly before or after an input or select within gcds components.

Describe the use case.

Enter the last three digits of your SIN:
XXX-XXX-[ ]

image

Describe the preferred solution.

We think this would be best implemented by exposing slots for before-elements or after-elements. Another idea might be exposing an interior template that could be modified by developers.

Describe all alternatives.

  • We can place the explanatory text after the entire gcds-input, but our designers won't like this as much.
  • We can put the gcds-input inside a wrapper with display:inline-block and put the explanatory text to the right side, but if there is an error message then the width of the gcds-input and its label, etc will be restricted. This wouldn't work at all for explanatory text to the left.
  • We can create separate components for label and error, but then we have to manually manage the DOM representing the error, as well as the error state on the input/select.

Provide related code or examples.

No response

Add other relevant resources.

No response

@SmartMouthWords
Copy link
Contributor

We received a similar question about whether "$" could be added to the input (in English it would be ahead of the field, in French after).

There are some known accessibility issues with putting explanatory text after the field. It could get chopped, pushed to the next line, or simply missed. We could explore the accessibility of including unit of measurement in the field/container as static text.

A workaround right now would be to include the unit of measure in the input (or other component) hint text.

@simberman-gc
Copy link
Author

Putting the text "inside" the input would be fine by us.

(That being said, I imagine you would have the same accessibility issue whether the text appears inside the input or outside? I'd imagine that your implementation probably has an actual input element somehow inside of it that the helper text will still be outside of? But hey, any reasonable implementation which gets text before and after the user-input space is a-ok.)

@daine daine added the development Development tasks label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Development tasks enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants