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

NEW SearchableDropdownField #1625

Merged

Conversation

emteknetnz
Copy link
Member

@emteknetnz emteknetnz commented Nov 20, 2023

@emteknetnz emteknetnz force-pushed the pulls/2/selectorfield branch 9 times, most recently from f06f6e2 to ba1afc1 Compare November 27, 2023 02:04
@emteknetnz emteknetnz changed the title NEW SelectorField NEW SearchableDropdownField Nov 27, 2023
@emteknetnz emteknetnz force-pushed the pulls/2/selectorfield branch 8 times, most recently from 3b564c8 to b58b63c Compare November 29, 2023 00:37
@emteknetnz
Copy link
Member Author

emteknetnz commented Dec 7, 2023

Design feedback:

  • try and remove arrow for lazy load

  • get rid of mid-grey hover state

  • get rid of 'active hover' state blue, make it mid-blue 'active non-hover state'

  • change padding on multi-selected options - react-select-9jq23d
    padding: 3px 10px 3px 10px;

.ss-searchable-dropdown-field__multi-value__remove
padding: 2px 5px 2px 5px;

.ss-searchable-dropdown-field__multi-value
change border color from #66afe9 (light blue) to grey #c1cad9

.ss-searchable-dropdown-field__multi-value
border-left: #c1cad9

.ss-searchable-dropdown-field__multi-value__remove:focus, .ss-searchable-dropdown-field__multi-value__remove:hover
background-color: #ffe0e0 (randomly grabbed, ideally would have an existing variable, or use calc() on $branch-danger)
color: #d40404 ($brand-danger)

@emteknetnz emteknetnz force-pushed the pulls/2/selectorfield branch from b58b63c to 59f23d7 Compare December 8, 2023 03:18
@emteknetnz
Copy link
Member Author

Design review implementation has been approved by internal design team

@emteknetnz emteknetnz force-pushed the pulls/2/selectorfield branch from 59f23d7 to cc38b64 Compare December 8, 2023 03:24
@emteknetnz emteknetnz marked this pull request as ready for review December 8, 2023 03:24
Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

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

Code looks broadly good.
Haven't fully tested it locally yet - will wait for the framework changes.

One thing I did notice: when I type to search, it swaps the dirty state of the form, making it look like there are unsaved changes.

IIRC we had that problem with tagfield somewhat recently as well.

client/src/bundles/bundle.js Show resolved Hide resolved
@emteknetnz emteknetnz force-pushed the pulls/2/selectorfield branch from cc38b64 to 19b6ab5 Compare December 12, 2023 22:27
@emteknetnz
Copy link
Member Author

I think I've fixed the issue with the fix the dirty state on search

@GuySartorelli
Copy link
Member

GuySartorelli commented Dec 13, 2023

If I select an option and then clear that option (without saving inbetween), the page still thinks I have unsaved changes.

  1. Page loads. No unsaved changes.
  2. I type a search term. No unsaved changes.
  3. I select an option. Page correctly identifies changes.
  4. I clear the selection. Page incorrectly thinks there are still unsaved changes.

@emteknetnz
Copy link
Member Author

emteknetnz commented Dec 13, 2023

I've tried really hard to fix this though I just cannot. There's a 'changed' class that gets added by jquery.changetracker to an <input> that react-select added. jquery.changetracker just blindly tracks virtually all inputs, which is great until you get situations like this.

The issue seems be that jquery.changetracker has full control over the 'changed' class being added and there's nothing you can do about it.

Setting a no-change-track className on the <DynamicComponent> will block all change tracking. I've tried that along with also adding in a new <input> property as a sibling to <DynamicComponent>, manually setting the className on the input to 'changed' based on whether there are changes and dispatching the change event from that element. But that doesn't work, I still don't get to control whether or not the 'changed' class appears on the input

@emteknetnz emteknetnz force-pushed the pulls/2/selectorfield branch 3 times, most recently from 592e82a to d077dfd Compare December 13, 2023 04:33
Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

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

Please add behat tests - especially for silverstripe/silverstripe-framework#11057 (comment)

@emteknetnz emteknetnz force-pushed the pulls/2/selectorfield branch from d077dfd to c63d013 Compare December 13, 2023 23:08
@emteknetnz
Copy link
Member Author

We don't have behat tests for FormFields in admin, instead we use jest tests. This PR has jest tests. For the 'clearable' functionality called out in silverstripe/silverstripe-framework#11057 (comment) - that's functionality on react-select so all the PHP code is doing is passing a prop to it

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

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

Looks good, works great locally.

@GuySartorelli GuySartorelli merged commit d6b66b0 into silverstripe:2 Dec 14, 2023
12 checks passed
@GuySartorelli GuySartorelli deleted the pulls/2/selectorfield branch December 14, 2023 20:09
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.

2 participants