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

[Controls] Use new panelMinWidth prop in popovers #165397

Merged

Conversation

Heenawter
Copy link
Contributor

@Heenawter Heenawter commented Aug 31, 2023

Closes #164375

Summary

This PR wraps up #162651 by fully migrating to the EuiInputPopover for all controls - specifically, this is made possible by the new panelMinWidth prop, which makes it so that the popover can now extend past the size of the input while maintaining the expected positioning.

Before After
The popover was centered underneath the control on the smallest size:

image
The popover is left-aligned with the start of the input and expands to the right:

image
The range slider popover could not extend past the control width, regardless of how small that was:

image
The range slider popover now also has a minimum width, which makes it more useable on the smallest size:

image

Checklist

For maintainers

@Heenawter Heenawter added Feature:Input Control Input controls visualization Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas loe:small Small Level of Effort release_note:skip Skip the PR/issue when compiling release notes impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. labels Aug 31, 2023
@Heenawter Heenawter force-pushed the control-euiInputPopover-minWidth_2023-08-31 branch from 3ef74a9 to d14f6fb Compare September 18, 2023 15:36
Comment on lines -127 to -131
&:not(.controlFrameWrapper--grow) {
.controlFrame__labelToolTip {
max-width: 20%;
}
}
Copy link
Contributor Author

@Heenawter Heenawter Sep 18, 2023

Choose a reason for hiding this comment

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

Now that the popover can extend past the input for range sliders, I don't think this specific styling is necessary anymore.

Before After
The control title takes up less space on the small size:

image
The control title takes up the same 40% even in the small size:

image

@@ -43,36 +41,33 @@ export const OptionsListPopover = ({
const [showOnlySelected, setShowOnlySelected] = useState(false);

return (
<>
<div
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just removed the wrapping fragment, since it's unnecessary - no other changes were made here.

@Heenawter Heenawter force-pushed the control-euiInputPopover-minWidth_2023-08-31 branch from 1e8b569 to 1758d28 Compare September 18, 2023 19:57
@@ -58,17 +57,6 @@ describe('Options list popover', () => {
showOnlySelectedButton.simulate('click');
};

test('available options list width responds to container size', async () => {
Copy link
Contributor Author

@Heenawter Heenawter Sep 19, 2023

Choose a reason for hiding this comment

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

The EUI panelMinWidth applies to the portal that is created for the popover, and not to the popover itself; this portal does not exist from within the popover component, so this test is no longer relevant.

@Heenawter Heenawter marked this pull request as ready for review September 19, 2023 13:46
@Heenawter Heenawter requested review from a team as code owners September 19, 2023 13:46
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@Heenawter
Copy link
Contributor Author

@elasticmachine merge upstream

@Heenawter Heenawter self-assigned this Sep 19, 2023
@nickpeihl nickpeihl self-requested a review September 20, 2023 18:17
Copy link
Member

@nickpeihl nickpeihl left a comment

Choose a reason for hiding this comment

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

lgtm!

code review and tested options list and range slider

hasArrow={false}
repositionOnScroll
isOpen={isPopoverOpen}
panelPaddingSize="none"
anchorPosition="downCenter"
panelMinWidth={MIN_POPOVER_WIDTH}
className="optionsList__inputButtonOverride"
initialFocus={'[data-test-subj=optionsList-control-search-input]'}
closePopover={() => optionsList.dispatch.setPopoverOpen(false)}
aria-label={OptionsListStrings.popover.getAriaLabel(fieldName)}
Copy link
Member

Choose a reason for hiding this comment

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

Not blocking, but I can't figure out how to get this aria-label to read in VoiceOver.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, good point! Looks like the aria-label just doesn't do anything for EuiInputPopover - I tested this here: https://codesandbox.io/s/laughing-aryabhata-585w4s?file=/demo.js.

Fixed in e82ccfc7b88a9cb2f64a8a9c8e5b181e29db7f50 by passing it in as a panelProp instead 👍

src/plugins/controls/public/constants.ts Show resolved Hide resolved
@Heenawter Heenawter force-pushed the control-euiInputPopover-minWidth_2023-08-31 branch from e82ccfc to 7675d64 Compare September 22, 2023 15:08
@Heenawter
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
controls 131 132 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
controls 188.7KB 188.3KB -382.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
controls 37.4KB 37.4KB -2.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @Heenawter

Copy link
Contributor

@andreadelrio andreadelrio left a comment

Choose a reason for hiding this comment

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

Design changes LGTM, great improvements!

@Heenawter Heenawter merged commit bafb235 into elastic:main Sep 22, 2023
@kibanamachine kibanamachine added v8.11.0 backport:skip This commit does not require backporting labels Sep 22, 2023
@Heenawter Heenawter deleted the control-euiInputPopover-minWidth_2023-08-31 branch September 22, 2023 19:03
joemcelroy pushed a commit to joemcelroy/kibana that referenced this pull request Sep 25, 2023
Closes elastic#164375

## Summary

This PR wraps up elastic#162651 by fully
migrating to the `EuiInputPopover` for all controls - specifically, this
is made possible by the new `panelMinWidth` prop, which makes it so that
the popover can now extend past the size of the input **while
maintaining** the expected positioning.

| Before | After |
|--------|--------|
| The popover was centered underneath the control on the smallest
size:<br><br>![image](https://github.com/elastic/kibana/assets/8698078/e2814ee2-6df6-47d6-925e-9f97cb8be2a5)
| The popover is left-aligned with the start of the input and expands to
the
right:<br><br>![image](https://github.com/elastic/kibana/assets/8698078/7c698ef0-1534-43b6-ac95-9ae95f1c7613)
|
| The range slider popover could not extend past the control width,
regardless of how small that
was:<br><br>![image](https://github.com/elastic/kibana/assets/8698078/12e33967-b616-4f0a-9ded-4374d65a51b2)
| The range slider popover now also has a minimum width, which makes it
more useable on the smallest
size:<br><br>![image](https://github.com/elastic/kibana/assets/8698078/2fb844db-8f5d-44d8-a6dc-c9cb95d5a4ea)
|

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Input Control Input controls visualization impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Controls] Use new panelMinWidth prop in EuiInputPopover
6 participants