Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.

OcCheckbox: add support for showing default values and clear buttons#1635

Open
dschmidt wants to merge 6 commits into
masterfrom
work/checkbox_defaultValue
Open

OcCheckbox: add support for showing default values and clear buttons#1635
dschmidt wants to merge 6 commits into
masterfrom
work/checkbox_defaultValue

Conversation

@dschmidt
Copy link
Copy Markdown
Member

@dschmidt dschmidt commented Sep 5, 2021

Description

This PR adds support for showing default values and a clear button to OcCheckbox.

It's not beautiful (visually) by any means and the same UX problems as for #1634 apply here too.

Needs UX concept by @kulmann and @tbsbdr

Related Issue

Motivation and Context

See #1634

How Has This Been Tested?

Screenshots (if appropriate):

Nothing selected by user
Screenshot_20210905_124232
Clicked once to switch value:
Screenshot_20210905_124309
Clicked twice to explicitly set value:
Screenshot_20210905_124336

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation added/updated

Open tasks:

  • ...

It's a bit more standard to not use v-model and split it into value binding and input event handling. Using a standard pattern makes it easier to reason about already and even more so when the clearButton is added in the next commit.
@update-docs
Copy link
Copy Markdown

update-docs Bot commented Sep 5, 2021

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

created() {
this.setChecked(this.model)
showClearButton() {
return this.clearButtonEnabled && this.value !== null
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.disabled needs to be taken into account.

@tbsbdr
Copy link
Copy Markdown
Contributor

tbsbdr commented Nov 3, 2021

Hey, this is admittedly a hard one from a ux perspective, and I agree - the reset-x for a checkbox might feel odd.

Requirements as I understood them:

  1. Reset Option: Provide an option to reset to the default
  2. Show if Default: Show at a glance if the default is currently selected or not

I'm not aware of a common pattern, that meets both requirements for checkboxes. But maybe this ideas might help:

Use OcSelect

Just don't use checkboxes at all for this usecase. Utilise your OcSelect instead like this:
image

Use text-button

As it might not be 100% expectable what the reset-x will do, a textbutton might make the action more predictable.
image

But: Ideas 3-5 don't meet the 2nd requirement "Show if Default".
In VSCode Settings, they tried to highlight changed options with the blue vertical line, which is okay but not the best understandable solution, as you need to learn what the color means.

Highlight changes with color:
2021-11-03_17-09-47 (1)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants