-
Notifications
You must be signed in to change notification settings - Fork 2k
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
SelectDropdown: cleanup code and migrate CSS to webpack #35086
Commits on Aug 16, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 95ffe52 - Browse repository at this point
Copy the full SHA 95ffe52View commit details -
SelectDropdown: instanceId doesn't need to be in state and be used fo…
…r keys Changes `instanceId` to be an instance property assigned during construction. No need to put it in state, as it never changes. Also, don't use `instanceId` to create `key` values. These don't need to be globally unique. Use them only for DOM element IDs that are used to link elements together with ARIA attributes.
Configuration menu - View commit details
-
Copy full SHA for 552c6c3 - Browse repository at this point
Copy the full SHA 552c6c3View commit details -
SelectDropdown: remove props argument of getInitialSelectedItem
We can always read from `this.props`. Even in constructor, because we called `super( props )`.
Configuration menu - View commit details
-
Copy full SHA for 688328a - Browse repository at this point
Copy the full SHA 688328aView commit details -
SelectDropdown: comment and improve the getInitialSelectedItem logic
Add comments about what the method does, and fix a bug where a separator item (specified as `null` in `options`) can potentially crash the `find`.
Configuration menu - View commit details
-
Copy full SHA for 4deb266 - Browse repository at this point
Copy the full SHA 4deb266View commit details -
SelectDropdown: toggle visibility of dropdown with visibility: hidden
Removes need for smart `tabIndex` logic: hidden elements are automatically excluded from tab order. `visibility: hidden`, as opposed to `display: none`, still takes the element into account when doing layout. Therefore, the dropdown header will continue to have the width of the widest option in the list.
Configuration menu - View commit details
-
Copy full SHA for a1eb241 - Browse repository at this point
Copy the full SHA a1eb241View commit details -
Configuration menu - View commit details
-
Copy full SHA for f0a736d - Browse repository at this point
Copy the full SHA f0a736dView commit details -
SelectDropdown: use modern refs for focusing item links
Replace string ref with a modern one, and create a `focusLink` instance method to provide API for the parent component that wants to set focus. Replace access to internal `itemRef.refs.itemLink` property.
Configuration menu - View commit details
-
Copy full SHA for 461cc13 - Browse repository at this point
Copy the full SHA 461cc13View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9295655 - Browse repository at this point
Copy the full SHA 9295655View commit details -
SelectDropdown: replace string itemRefs with modern ones
Use an array of refs to focusable items, set them with a callback, move the `refIndex` increment inline to calling expression.
Configuration menu - View commit details
-
Copy full SHA for e4b2f58 - Browse repository at this point
Copy the full SHA e4b2f58View commit details -
SelectDropdown: cloned children don't need a key
`key` is needed only when passing array of children. In this case, the children are written as JSX and `key` doesn't need to be added on cloning and mapping 1:1.
Configuration menu - View commit details
-
Copy full SHA for 6f0f107 - Browse repository at this point
Copy the full SHA 6f0f107View commit details -
SelectDropdown: only DropdownItem children need to be cloned and amended
Only `DropdownItem` needs a ref (it's focusable and the ref is used to move focus on up and down keyboard navigation) and an `onClick` handler. Separator and Label are neither focusable nor clickable.
Configuration menu - View commit details
-
Copy full SHA for bd515ee - Browse repository at this point
Copy the full SHA bd515eeView commit details -
SelectDropdown: ignore clicks on Label and Separator, add a11y role
Clicks on label and separator should not bubble to the parent element and cause the dropdown to close. This patch adds a missing handler to the separator component (label is already OK). Also adds an a11y role to specify that the element is not interactive despite having an `onClick` handler.
Configuration menu - View commit details
-
Copy full SHA for cf37742 - Browse repository at this point
Copy the full SHA cf37742View commit details -
SelectDropdown: simplify setting initial state
Can be done by assinging an instance property instead of full constructor. Also, `getInitialSelectedItem` already handles the case where `options` prop is not present or empty.
Configuration menu - View commit details
-
Copy full SHA for 55bfde9 - Browse repository at this point
Copy the full SHA 55bfde9View commit details -
SelectDropdown: remove unneeded componentWillReceiveProps
Closing the popup when receiving new props doesn't seem to make much sense. And the initial selected value is set only on initial mount and further changes of the prop are ignored. That's the common behavior of initial-ish props on uncontrolled components. For example, native `<input defaultValue="x" />` renders input box with "x" and doesn't change the value on further rerenders with a different prop.
Configuration menu - View commit details
-
Copy full SHA for 80c5256 - Browse repository at this point
Copy the full SHA 80c5256View commit details -
SelectDropdown: no need to look at initial selected item in getSelect…
…edText or Icon In the `getSelectedText` and `getSelectedIcon` getters, the currently selected value is always in `this.state.selected`. No need to default to the initial value. Also, use `_.get` instead of `_.result`, as `icon` and `label` are not functions.
Configuration menu - View commit details
-
Copy full SHA for 6f4a029 - Browse repository at this point
Copy the full SHA 6f4a029View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1e34bbd - Browse repository at this point
Copy the full SHA 1e34bbdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 25fa960 - Browse repository at this point
Copy the full SHA 25fa960View commit details -
Configuration menu - View commit details
-
Copy full SHA for b27fa72 - Browse repository at this point
Copy the full SHA b27fa72View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9132ff1 - Browse repository at this point
Copy the full SHA 9132ff1View commit details -
Configuration menu - View commit details
-
Copy full SHA for fe294bc - Browse repository at this point
Copy the full SHA fe294bcView commit details -
Configuration menu - View commit details
-
Copy full SHA for e17e807 - Browse repository at this point
Copy the full SHA e17e807View commit details -
SelectDropdown: rework docs and devdocs example to use the SelectDrop…
…down._ convention
Configuration menu - View commit details
-
Copy full SHA for e258936 - Browse repository at this point
Copy the full SHA e258936View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7012304 - Browse repository at this point
Copy the full SHA 7012304View commit details -
Configuration menu - View commit details
-
Copy full SHA for 72f9842 - Browse repository at this point
Copy the full SHA 72f9842View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1f27220 - Browse repository at this point
Copy the full SHA 1f27220View commit details -
Configuration menu - View commit details
-
Copy full SHA for 19023f0 - Browse repository at this point
Copy the full SHA 19023f0View commit details -
SelectDropdown: update unit tests
Some of them were quite awful, spying on internal method calls or mocking the whole component instance instead of testing on the real component and checking its state and JSDOM rendering.
Configuration menu - View commit details
-
Copy full SHA for b09fabe - Browse repository at this point
Copy the full SHA b09fabeView commit details -
Configuration menu - View commit details
-
Copy full SHA for dd17c67 - Browse repository at this point
Copy the full SHA dd17c67View commit details -
SelectDropdown: hide the dropdown options when the dropdown is closed
Otherwise, the options element is clickable although it has `visibility: hidden` and captures clicks on controls that are underneath it.
Configuration menu - View commit details
-
Copy full SHA for c9b3c11 - Browse repository at this point
Copy the full SHA c9b3c11View commit details