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

Implement success state for OnyxFormElement #573

Closed
13 tasks done
larsrickert opened this issue Mar 11, 2024 · 3 comments
Closed
13 tasks done

Implement success state for OnyxFormElement #573

larsrickert opened this issue Mar 11, 2024 · 3 comments
Assignees
Labels
dev Requires technical expertise
Milestone

Comments

@larsrickert
Copy link
Collaborator

larsrickert commented Mar 11, 2024

Depends on

Why?

There are cases where it is necessary to communicate an explicit success state for an FormElement:

  • To highlight the validity of important inputs (E.g., a password input on sign-up)
  • To show validity after an asynchronous validation (E.g. Chosen username is available).
  • To show the successful execution of an action related to the input (E.g., Value copied to the clipboard)

The (validation) valid state independent of the success state:

  • the success state is set explicitly and not the implicit result of validation
  • the validation error state has higher priority than the success
  • the success state does not change or affect the validation
  • for now only support for inputs (text, select) and not for textarea

Design

https://www.figma.com/design/EBi98T51T9fGfjrYYfsulg/onyx---Archive?node-id=3427-73120&t=WFV3kII28sKTTZft-4

Acceptance criteria

  • A new type FormMessage is created
  • message, successMessage, errorMessage all use the new type
      • Message precedence from highest to lowest:
        1. errorMessage
        2. html native validation error message
        3. successMessage
        4. message
  • when successMessage is shown, a green checkmark symbol is shown on the right -> Follow up Implement green checkmark on OnyxInput #2143
  • All existing components that use the OnyxFormElement are extended to support the new API
  • Follow-up from Fix small layout jump on invalid OnyxInput / OnyxFormElement #1731: Refactor to only show onyx-form-element__footer when any message is shown: Right now the gap is from the parent is applied even when no message is visible

Definition of Done

  • covered by component tests
  • screenshot tests are updated
  • follow-up tickets were created if necessary
  • updated version + documentation is deployed
  • Storybook can show the feature
  • Set task to In Approval

Review

Implementation details

Consider that success might be shown without message, but error should never be shown without message. Also, do we still need a message for a11y reasons?

/**
  * If it's just a string it acts as `FormErrorMessage.shortMessage`
  */
export type FormErrorMessage = string | {
  /**
   * A short error message preview that is shown permanently beneath the input field
   */
  shortMessage: string;
  /**
   * An extended message that is shown temporarily after hovering over the message tooltip.
   */
  longMessage?: string;
};
/**
  * Message precedence from highest to lowest:
  * 1. `errorMessage`
  * 2. html native validaiton error message
  * 3. `successMessage`
  * 4. `message`
  */
export type OnyxFormElementProps = {
  // Refactor the messages to take the same format:
  successMessage?: FormErrorMessage;
  errorMessage?: FormErrorMessage;
  message?: FormErrorMessage;
}
@larsrickert larsrickert added this to onyx Mar 11, 2024
@larsrickert larsrickert converted this from a draft issue Mar 11, 2024
@larsrickert larsrickert self-assigned this Mar 11, 2024
@larsrickert larsrickert added the dev Requires technical expertise label Mar 11, 2024
@larsrickert larsrickert added this to the Text input milestone Mar 11, 2024
@larsrickert larsrickert moved this from New to Backlog in onyx Mar 11, 2024
@larsrickert larsrickert mentioned this issue Mar 11, 2024
28 tasks
@larsrickert larsrickert moved this from Backlog to Ready in onyx Mar 20, 2024
@larsrickert larsrickert removed their assignment Mar 20, 2024
@larsrickert larsrickert changed the title Implement input copy/clear icon and valid state Implement input/textarea copy/clear icon and valid state May 22, 2024
@larsrickert larsrickert changed the title Implement input/textarea copy/clear icon and valid state Implement input/textarea/select copy/clear icon and valid/success state Jun 25, 2024
@larsrickert larsrickert moved this from Ready to New in onyx Jun 25, 2024
@BoppLi BoppLi changed the title Implement input/textarea/select copy/clear icon and valid/success state Implement copy/clear icon and valid/success state for input/textarea/select Jun 26, 2024
@BoppLi BoppLi self-assigned this Jun 26, 2024
@BoppLi BoppLi moved this from New to Backlog in onyx Jun 26, 2024
@BoppLi BoppLi changed the title Implement copy/clear icon and valid/success state for input/textarea/select Implement copy/clear icon and valid/success state for input/select Jun 26, 2024
@mj-hof
Copy link
Collaborator

mj-hof commented Jun 26, 2024

@jannick-ux Open questions:

  • What's the use case behind that success/valid state?
  • Do we need the "copy"-button? Misleading user interactive?
  • What about text area, selection controls - do they have a valid/success state as well?

@mj-hof mj-hof moved this from Backlog to Ready in onyx Jun 26, 2024
@jannick-ux
Copy link
Collaborator

  • The success state can be used for forms that need to be validated (e.g. the user needs to fill out his personal data and the system checks, if the username could be validated). It is a completely optional thing for concepting, although it could be really handy in some usecases. So I created it as an optional addition.
  • The copy icon is optional as well. It gives the opportunity to copy the content with one single click. I got the request of this features from several sources. Why do you think it is misleading?
  • Selection controls don't have text area because the "success indicator" validates an input, but not a binary choise.
    Text areas have no success state as well, because of their purpose. They aren't used for inputs that can be correct or incorrect (like the OnyxInput does). The have the purpose to insert continuous text (that can be formatted). Continuous text cannot be valid or invalid.

@mj-hof mj-hof moved this from Ready to Backlog in onyx Jul 29, 2024
@mj-hof mj-hof added the 0-refinement All issues that can or need to be estimated in our next refinement label Jul 29, 2024
@mj-hof mj-hof self-assigned this Jul 29, 2024
@JoCa96 JoCa96 assigned JoCa96 and unassigned mj-hof Aug 1, 2024
@JoCa96 JoCa96 removed the 0-refinement All issues that can or need to be estimated in our next refinement label Aug 1, 2024
@JoCa96 JoCa96 moved this from Backlog to New in onyx Aug 1, 2024
@JoCa96 JoCa96 changed the title Implement copy/clear icon and valid/success state for input/select Implement success state for OnyxFormElement Sep 18, 2024
@JoCa96 JoCa96 moved this from New to Backlog in onyx Sep 18, 2024
@JoCa96
Copy link
Collaborator

JoCa96 commented Sep 18, 2024

Story was split and "Copy action" is moved to #1887

@JoCa96 JoCa96 added the 0-refinement All issues that can or need to be estimated in our next refinement label Sep 18, 2024
@mj-hof mj-hof removed the 0-refinement All issues that can or need to be estimated in our next refinement label Oct 9, 2024
@mj-hof mj-hof moved this from Backlog to Ready in onyx Oct 9, 2024
@MajaZarkova MajaZarkova moved this from Ready to In Progress in onyx Oct 31, 2024
MajaZarkova added a commit that referenced this issue Nov 4, 2024
…2031)

<!-- Is your PR related to an issue? Then please link it via the
"Relates to #" below. Else, remove it. -->

Relates to #573 

Add successMessage prop to useCustomValidity composable. This property
will be provided in OnyxForm component and later injected by it's child
input components to represent the success state.
@JoCa96 JoCa96 self-assigned this Nov 13, 2024
MajaZarkova added a commit that referenced this issue Nov 25, 2024
…2050)

<!-- Is your PR related to an issue? Then please link it via the
"Relates to #" below. Else, remove it. -->

Relates to #573 

Implement success messages to OnyxFormElement and success state of
OnyxInput

---------

Co-authored-by: Jonathan Carle <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@MajaZarkova MajaZarkova moved this from In Progress to In Approval in onyx Nov 25, 2024
MajaZarkova added a commit that referenced this issue Nov 25, 2024
<!-- Is your PR related to an issue? Then please link it via the
"Relates to #" below. Else, remove it. -->

Relates to #573 

Implemented success styles for OnyxTextarea

## Checklist

- [x] The added / edited code has been documented with
[JSDoc](https://jsdoc.app/about-getting-started)
- [x] All changes are documented in the documentation app (folder
`apps/docs`)
- [x] If a new component is added, at least one [Playwright screenshot
test](https://github.com/SchwarzIT/onyx/actions/workflows/playwright-screenshots.yml)
is added
- [x] A changeset is added with `npx changeset add` if your changes
should be released as npm package (because they affect the library
usage)

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-project-automation github-project-automation bot moved this from In Approval to Done in onyx Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev Requires technical expertise
Projects
Status: Done
Development

No branches or pull requests

6 participants