Skip to content

Search#94

Merged
100stacks merged 12 commits intomasterfrom
search
Jun 25, 2020
Merged

Search#94
100stacks merged 12 commits intomasterfrom
search

Conversation

@nicko-winner
Copy link
Contributor

@nicko-winner nicko-winner commented Jun 15, 2020

2020-06-15_15-08-42

@netlify
Copy link

netlify bot commented Jun 15, 2020

Deploy preview for helix-react ready!

Built with commit e3bb849

https://deploy-preview-94--helix-react.netlify.app

...rest
}) => {
return (
<hx-search-control class={className} id={wrapperId}>
Copy link
Contributor Author

@nicko-winner nicko-winner Jun 15, 2020

Choose a reason for hiding this comment

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

we have prop called wrapperId because id is being passed to the input. This seems to be the convention for input that @michaelmang started. Note: <.*-control /> elements don't seem to need id's as frequently as the inputs, search may be the only one control wrapper that needs and ID?

/**
* @see https://helixdesignsystem.github.io/helix-ui/components/search/
*/
const SearchAssist = ({ children, onFocus, onBlur, ...rest }) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

React framework specific implementation of hx-search-assistance that supports opening and closing.

{...(label && { label })}
{...(optional && { optional })}
{...(required && { required })}
{...(position && { position })}
Copy link
Member

Choose a reason for hiding this comment

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

It appears the position is getting transposed for bottom-center and top-center...I wonder if this is something in HelixUI logic?

screenshot bottom-center:

Screen Shot 2020-06-16 at 11 27 11 AM

screenshot top-center:

Screen Shot 2020-06-16 at 11 26 30 AM

Copy link
Contributor Author

@nicko-winner nicko-winner Jun 16, 2020

Choose a reason for hiding this comment

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

This is an issue in the helix positioning logic. We are sending the correct props. The storybook controls on the bottom for knobs are pushing up against the bottom of the search suggestion box. I think this issue exists for all helix positionable elements.

Examples from official helix docs:
2020-06-16_17-16-34

Popover is a good place to reproduce this issue inside helix:
https://helixdesignsystem.github.io/helix-ui/components/popover/

make your window smaller so helix places the popover, on top, then choose the top-right option on popover, and it will reverse the logic.
2020-06-16_17-22-05

Copy link
Member

Choose a reason for hiding this comment

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

Ok makes sense, I see it's the size of the Storybook preview pane for me. Yes, that's the default behavior for HelixUI components with the positioning logic.

Copy link
Member

Choose a reason for hiding this comment

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

Btw what are your thoughts the positioning behavior? Any tweaks needed?

Copy link
Contributor Author

@nicko-winner nicko-winner Jun 17, 2020

Choose a reason for hiding this comment

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

I think the fix in helix might look like this: Before trying to reposition an item make sure there is more space in the direction the menu wants to reposition in. Maybe only trigger the reposition if there is at least 50-100px more space in the direction it wants to reposition into. If there is not, then keep its existing position. That may help menus from prepositioning from a bad fit to an unintended worse fit. Or maybe there is an option to disable position changing for use cases that do not need that behavior?

Copy link
Member

@100stacks 100stacks Jun 17, 2020

Choose a reason for hiding this comment

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

That's really great feedback. Most of our use cases were based on users scrolling, and the direction they are scrolling.

Here's the collision detection logic:

https://github.com/HelixDesignSystem/helix-ui/blob/master/src/utils/alignment/index.js#L229-L300

Good suggestion for allowing implementors an option to disable the collision detection.

Copy link
Member

@100stacks 100stacks left a comment

Choose a reason for hiding this comment

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

Dev LGTM

- Fixed bug where you could not click item before before search assist was removed from DOM
- Fix propTypes errors
- Make story book example more realistic by allowing us to select an item
- Make sure search is no longer centered to prevent positioning bug from showing up in demo.
@nicko-winner nicko-winner requested a review from 100stacks June 18, 2020 20:21
relativeTo={`${rest.id}-hx-search-control`}
open={wcBool(open)}
position={position}
onClick={() => setOpen(false)}
Copy link
Contributor Author

@nicko-winner nicko-winner Jun 18, 2020

Choose a reason for hiding this comment

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

When using onBlur like on the Helix docs one can not register a click on search assistance button before it closes, unless you use a setTimeout. This is a work around for that issue.

Copy link
Member

Choose a reason for hiding this comment

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

hey @nicko-winner, thanks for bringing this to my attention. I'll log it on my end.

Have you noticed this behavior with other HelixUI components?

Copy link
Contributor Author

@nicko-winner nicko-winner Jun 24, 2020

Choose a reason for hiding this comment

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

To my knowledge this the the only place where docs are using onBlur behavior connected to a menu like item opening and closing that may require user interaction.

Copy link
Contributor

@michaelmang michaelmang left a comment

Choose a reason for hiding this comment

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

Looks great!

add classname to propTypes
Copy link
Member

@100stacks 100stacks left a comment

Choose a reason for hiding this comment

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

Good job! Dev LGTM

@100stacks 100stacks merged commit 57b0b93 into master Jun 25, 2020
@100stacks 100stacks deleted the search branch June 25, 2020 22:09
@100stacks 100stacks added this to the v1.0.0-rc.0 milestone Jul 21, 2020
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.

3 participants