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

Display Currently Active Dropdown Option as Selected #217

Merged
merged 1 commit into from
Jun 4, 2022

Conversation

muya
Copy link
Contributor

@muya muya commented Jun 4, 2022

For dropdown settings, show the currently active (user-chosen) one as the selected one on the UI.

Fixes #216


Issue Description

When dropdown options load in settings, the user-selected options are not shown as the currently selected item.

Steps to Reproduce

We can use the "Capitalize Headings > Style" option to demonstrate.

  1. Open Obsidian Linter settings, and scroll down to the "Capitalize Headings" section
  2. For the "Style" dropdown, choose a setting that's different from what's currently enabled. For example, if "Title Case" is currently your preferred setting, choose "All Caps".
  3. Close the settings page. (Optional: test that the linter is now changing headings to "ALL CAPS").
  4. Re-open the settings page, and scroll down to "Capitalize Headings"

Expected: that the newly selected option "ALL CAPS" is chosen as the Style (i.e. with a checkmark), and is currently shown

Actual: "Title Case" is still chosen as the Style, and it has the checkmark.

(see full details in #216)


Testing

  • Manual testing was done to verify this change
  • Any guidance on how / where we can add unit tests for this would be appreciated

Before Fix

The value shown in the drop-down always defaults to "Title Case", despite the currently selected user setting

obsidian-linter-dropdown-settings-display-before-fix.mp4

After Fix

The currently selected user setting is now displayed as the active option in the dropdown

obsidian-linter-dropdown-settings-display-after-fix.mp4

For dropdown settings, show the currently active (user-chosen) one as the selected one on the UI.

Fixes platers#216
@platers
Copy link
Owner

platers commented Jun 4, 2022

Thanks for the detailed documentation and fix!

@platers platers merged commit 53ff720 into platers:master Jun 4, 2022
@muya muya deleted the fix-selected-dropdown-option-display branch June 5, 2022 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Chosen Dropdown Option Not Showing as Selected
2 participants