Skip to content

[SharedUX] Add feedback snippet to SharedUX storybook#235197

Merged
angeles-mb merged 3 commits intoelastic:mainfrom
angeles-mb:234863-add-feedback-snippet-to-shared-ux-storybook
Sep 18, 2025
Merged

[SharedUX] Add feedback snippet to SharedUX storybook#235197
angeles-mb merged 3 commits intoelastic:mainfrom
angeles-mb:234863-add-feedback-snippet-to-shared-ux-storybook

Conversation

@angeles-mb
Copy link
Contributor

@angeles-mb angeles-mb commented Sep 16, 2025

Closes #234863

Summary

Testing

Tested divider on scrollable submenus:

Screenshot 2025-09-16 at 12 05 47

Tested divider on non-scrollable submenus:

Screenshot 2025-09-16 at 13 06 05

Storybook looks:

Screenshot 2025-09-16 at 12 07 13

@angeles-mb angeles-mb self-assigned this Sep 16, 2025
@angeles-mb angeles-mb requested a review from a team as a code owner September 16, 2025 12:27
@angeles-mb angeles-mb added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// labels Sep 16, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)


export const Confetti = () => (
<Suspense fallback={null}>
<LazyConfetti />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to wrap Confetti component in Suspense to avoid this error which happened both in Storybook and when testing the component in other parts of Kibana Error: A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition.

By doing this, FeedbackSnippet consumers don't have to worry about its lazy loading.

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: you can also use dynamic

import { dynamic } from '@kbn/shared-ux-utility';

export const Confetti = dynamic(() => import('./confetti'));

Confetti also doesn't require a default export. You can remove the eslint disable and default export and use dynamic for that, too:

import { dynamic } from '@kbn/shared-ux-utility';

export const Confetti = dynamic(() => import('./confetti').then(
  mod => ({default: mod.Confetti})
);

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 didn't know about that dynamic utility, thanks for sharing! Addressed!

Copy link
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

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

lgtm,
have a suggestion to consider

feedbackSnippetId={feedbackSnippetId}
promptViewMessage={promptViewMessage}
surveyUrl={feedbackSurveyUrl}
showFeedbackButtonTopDivider={true}
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels very specific. Maybe this should just be a CSS override or addition instead.

<FeedbackSnippet
      css={`top-divider-css-goes-here`}
      feedbackButtonMessage={feedbackButtonMessage}
      feedbackSnippetId={feedbackSnippetId}
      promptViewMessage={promptViewMessage}
      surveyUrl={feedbackSurveyUrl}

Copy link
Contributor

Choose a reason for hiding this comment

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

Another option would be to encapsulate this change with some more expressive prop, like type or contained. For example, if we want to include a top divider when the FeedbackSnippet is contained within a panel, you can use "contained", or similar.

In other words, add a more expressive prop. From this, I don't know why I would or would not set this prop.

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 agree it is too specific, I went with the css + className approach for the NavigationFeedbackSnippet to be able to use custom styling (only for the Button, not the Panel).

Copy link
Contributor

@clintandrewhall clintandrewhall left a comment

Choose a reason for hiding this comment

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

Great job! Please address these nits before committing.


export const Confetti = () => (
<Suspense fallback={null}>
<LazyConfetti />
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: you can also use dynamic

import { dynamic } from '@kbn/shared-ux-utility';

export const Confetti = dynamic(() => import('./confetti'));

Confetti also doesn't require a default export. You can remove the eslint disable and default export and use dynamic for that, too:

import { dynamic } from '@kbn/shared-ux-utility';

export const Confetti = dynamic(() => import('./confetti').then(
  mod => ({default: mod.Confetti})
);

css={css`
margin: ${euiTheme.size.m};
padding: ${euiTheme.size.s};
${showTopDivider && `border-top: 1px ${euiTheme.colors.borderBaseSubdued} solid;`}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: isn't 1px a border width on euiTheme, as well?

Suggested change
${showTopDivider && `border-top: 1px ${euiTheme.colors.borderBaseSubdued} solid;`}
${showTopDivider && `border-top: ${euiTheme.border.width.thin} ${euiTheme.colors.borderBaseSubdued} solid;`}

Copy link
Contributor

Choose a reason for hiding this comment

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

@eokoneyo Shouldn't this have thrown an eslint warning?

} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import type { FeedbackView } from './feedback_snippet';
import Confetti from './confetti/confetti';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: prefer a barrel import. If you're importing the non-lazy component, export it from the barrel as ConfettiComponent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yes, thanks for noticing!

feedbackSnippetId={feedbackSnippetId}
promptViewMessage={promptViewMessage}
surveyUrl={feedbackSurveyUrl}
showFeedbackButtonTopDivider={true}
Copy link
Contributor

Choose a reason for hiding this comment

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

Another option would be to encapsulate this change with some more expressive prop, like type or contained. For example, if we want to include a top divider when the FeedbackSnippet is contained within a panel, you can use "contained", or similar.

In other words, add a more expressive prop. From this, I don't know why I would or would not set this prop.


const LazyConfetti = lazy(() => import('./confetti'));

export const Confetti = () => (
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: exports need documentation.

@angeles-mb angeles-mb force-pushed the 234863-add-feedback-snippet-to-shared-ux-storybook branch from 599446a to 82bf2d9 Compare September 17, 2025 09:56
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Integration Tests #6 / unrecognized task types should be no workload aggregator errors when there are removed task types

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
core 562 563 +1

Async chunks

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

id before after diff
core 131.2KB 131.7KB +485.0B

Page load bundle

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

id before after diff
core 511.3KB 511.3KB +2.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
@kbn/shared-ux-feedback-snippet 1 0 -1

Total ESLint disabled count

id before after diff
@kbn/shared-ux-feedback-snippet 1 0 -1

History

cc @angeles-mb

@angeles-mb angeles-mb merged commit 95b0206 into elastic:main Sep 18, 2025
13 checks passed
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Sep 24, 2025
Closes elastic#234863

## Summary

- Added feedback snippet to our Storybook with custom controls to test
props
- Integrated some UI tweaks suggested by @ek-so
elastic#234499
  - A top divider for the feedback button
  - Smaller buttons

## Testing

Tested divider on scrollable submenus:

<img width="743" height="1051" alt="Screenshot 2025-09-16 at 12 05 47"
src="https://github.com/user-attachments/assets/75589637-9adc-4bfb-99a1-ccccf50b00e9"
/>

Tested divider on non-scrollable submenus:

<img width="743" height="1043" alt="Screenshot 2025-09-16 at 13 06 05"
src="https://github.com/user-attachments/assets/69ba7b47-b3e0-4624-aa1a-0d1ea7f32e6b"
/>

Storybook looks:

<img width="895" height="1019" alt="Screenshot 2025-09-16 at 12 07 13"
src="https://github.com/user-attachments/assets/dba37ae4-9055-4b6b-8494-870c35f81890"
/>

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
niros1 pushed a commit that referenced this pull request Sep 30, 2025
Closes #234863

## Summary

- Added feedback snippet to our Storybook with custom controls to test
props
- Integrated some UI tweaks suggested by @ek-so
#234499
  - A top divider for the feedback button
  - Smaller buttons

## Testing

Tested divider on scrollable submenus:

<img width="743" height="1051" alt="Screenshot 2025-09-16 at 12 05 47"
src="https://github.com/user-attachments/assets/75589637-9adc-4bfb-99a1-ccccf50b00e9"
/>

Tested divider on non-scrollable submenus:

<img width="743" height="1043" alt="Screenshot 2025-09-16 at 13 06 05"
src="https://github.com/user-attachments/assets/69ba7b47-b3e0-4624-aa1a-0d1ea7f32e6b"
/>

Storybook looks:

<img width="895" height="1019" alt="Screenshot 2025-09-16 at 12 07 13"
src="https://github.com/user-attachments/assets/dba37ae4-9055-4b6b-8494-870c35f81890"
/>

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>

return (
<FeedbackSnippet
css={css`
Copy link
Contributor

Choose a reason for hiding this comment

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

@angeles-mb this border should likely be on side nav side, and removed in high contrast mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding this on the side nav side will also add it for the feedback panel. Is this what we want?

Screenshot 2025-10-15 at 17 10 25

I think the panel looks better without it but let me know your thoughts @ek-so @weronikaolejniczak

Copy link
Contributor

Choose a reason for hiding this comment

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

@angeles-mb IMO the panel looks better without it as well.

Because we want to expose this panel slot for solution teams to possibly put rich content there, would we need the separation? That is also something to consider.

Copy link
Contributor

Choose a reason for hiding this comment

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

@angeles-mb Wait, I'm confused 🤔 Looking at the code, FeedbackSnippet encompasses the whole feedback including the "Navigation feedback" redirection button. So how is adding the border-top different here than adding it to sidePanelFooter slot?

Copy link
Contributor Author

@angeles-mb angeles-mb Oct 16, 2025

Choose a reason for hiding this comment

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

@weronikaolejniczak That's because the className styles are intentionally not being propagated to the FeedbackPanel but only to the FeedbackButton.

My initial approach was to have a specific boolean prop to decide whether to show the divider or not for the button. See here. I know the current approach is not transparent for FeedbackSnippet consumers.

In any case, I'm ok with moving it to the SideNav if that is what we want for both flavors and for other potential content on that footer.

Copy link
Contributor

Choose a reason for hiding this comment

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

@angeles-mb hmm I don't like either option, to be honest - a boolean flag or CSS override. It's not immediately clear that FeedbackPanel doesn't inherit these styles. IMHO it's side nav container that should say "I want there to be a border between the menu and footer slot" regardless of the footer slot content. It feels more expected.

That being said, the result would be ☝🏻 and I agree with you, probably @ek-so does as well, that it doesn't look good. So let's leave it as is for now 😄 Thanks for explaining!

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we have a lot of borders everywhere... cleaner without it here 🙈

onClick={handleOpenSurvey}
css={css`
width: 100%;
padding: ${euiTheme.size.s};
Copy link
Contributor

Choose a reason for hiding this comment

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

@ek-so is this expected to be overriding the padding of the EuiButtonEmpty? 🤔 The way I see it the consumer should just be able to say size="s" and everything adjust accordingly. Otherwise, we introduce inconsistencies.

Copy link
Contributor

Choose a reason for hiding this comment

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

Tbh I don't understand what does this prop do here (I mean, literally, does it have any visual effect)? To me it looks like it doesn't 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for reviewing! This padding was coming from your original PR @ek-so but it's true that it doesn't add much as you mentioned: button and container sizes are the same with (left) and without (right) the padding:
Screenshot 2025-10-15 at 17 13 01

We can easily remove the padding.

Copy link
Contributor

Choose a reason for hiding this comment

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

@angeles-mb perfect! Thanks for checking, Angeles.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you both! It seems, I forgot to remove 🙈

rylnd pushed a commit to rylnd/kibana that referenced this pull request Oct 17, 2025
Closes elastic#234863

## Summary

- Added feedback snippet to our Storybook with custom controls to test
props
- Integrated some UI tweaks suggested by @ek-so
elastic#234499
  - A top divider for the feedback button
  - Smaller buttons

## Testing

Tested divider on scrollable submenus:

<img width="743" height="1051" alt="Screenshot 2025-09-16 at 12 05 47"
src="https://github.com/user-attachments/assets/75589637-9adc-4bfb-99a1-ccccf50b00e9"
/>

Tested divider on non-scrollable submenus:

<img width="743" height="1043" alt="Screenshot 2025-09-16 at 13 06 05"
src="https://github.com/user-attachments/assets/69ba7b47-b3e0-4624-aa1a-0d1ea7f32e6b"
/>

Storybook looks:

<img width="895" height="1019" alt="Screenshot 2025-09-16 at 12 07 13"
src="https://github.com/user-attachments/assets/dba37ae4-9055-4b6b-8494-870c35f81890"
/>

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SideNav] Quick UI tweaks

7 participants