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

fix: ailabel autoalign was not working #17659

Conversation

preetibansalui
Copy link
Contributor

Closes #17571

AILable auto align was not working

Changelog

New

Added shift in middleware of popover component. It prevents the floating element from overflowing along its axis of alignment, thereby preserving the side it’s placed on.

Testing / Reviewing

  1. Go to storybook > AILable > Default Story
  2. Click on AI Label, AILabelContent should become fully visible and avoid overflowing along its axis..

@preetibansalui preetibansalui requested a review from a team as a code owner October 7, 2024 06:13
Copy link

netlify bot commented Oct 7, 2024

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit dd53e95
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/671ff5012b11e400081918d5
😎 Deploy Preview https://deploy-preview-17659--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Oct 7, 2024

Deploy Preview for v11-carbon-react ready!

Name Link
🔨 Latest commit dd53e95
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/671ff501f6751b0008b18be5
😎 Deploy Preview https://deploy-preview-17659--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Oct 7, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 80.78%. Comparing base (f351df6) to head (dd53e95).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
packages/react/src/components/Popover/index.tsx 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17659      +/-   ##
==========================================
- Coverage   80.79%   80.78%   -0.01%     
==========================================
  Files         406      406              
  Lines       14041    14045       +4     
  Branches     4367     4399      +32     
==========================================
+ Hits        11344    11346       +2     
- Misses       2530     2531       +1     
- Partials      167      168       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@alisonjoseph alisonjoseph left a comment

Choose a reason for hiding this comment

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

LGTM, just a small code comment to cleanup

@tay1orjones
Copy link
Member

Technically this doesn't follow the design spec for Popover. The caret placement is dynamic and isn't using one of the allowed/specified alignments for Popover.

This is from the original issue:

Do you know why does it not reflow to use an alignment option where the caret is on the left top like this from the spec?
2024-10-07 at 14 37 59-Popover – Carbon Design System-Google Chrome@2x

@preetibansalui
Copy link
Contributor Author

Technically this doesn't follow the design spec for Popover. The caret placement is dynamic and isn't using one of the allowed/specified alignments for Popover.

This is from the original issue: Do you know why does it not reflow to use an alignment option where the caret is on the left top like this from the spec? ![2024-10-07 at 14 37 59-Popover – Carbon Design System-Google Chrome@2x](https://private-user-images.githubusercontent.com/3360588/374306388-d4ccb0ca-746c-422a-8cdd-b8ae82057d0c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mjg0NTIyOTksIm5iZiI6MTcyODQ1MTk5OSwicGF0aCI6Ii8zMzYwNTg4LzM3NDMwNjM4OC1kNGNjYjBjYS03NDZjLTQyMmEtOGNkZC1iOGFlODIwNTdkMGMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MTAwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDEwMDlUMDUzMzE5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MmI3OGY0MTg3ZTAxMzYzYjM1ODhiNmM4ZGQ3YmNmN2U3NWVjOTllZjRiOTA4YWEzNzYwMDc1YjkzZGQ2YTM0NyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.HNZZJUlh45U4NJMe90whoa-Znk9BwAAr7WKlyft-ITk)

Hi Taylor, Thanks It didn't comes to my mind about design spec guidelines. Thanks for pointing this out.

Do you know why does it not reflow to use an alignment option where the caret is on the left top like this from the spec? !

Its a very good question and it actually blew my mind. I think about this a lot and found if it will be right align then also it would hide the AI Label content from top part. pls check the attached picture. Also, its same for popover and toogletip components. The problem doesn't get noticed for them bcs their content window is small in size as compared to AILabel so it get adjusted in either direction.
image

Please suggest what is the correct way to tackle the situation when available window size would hide the content in atleast one direction.

Note: by default it try to take left-top direction as we are providing fallbackAxisSideDirection: 'start' to flip in middleware.

Copy link

netlify bot commented Oct 17, 2024

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit dd53e95
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/671ff501e59517000885aeaa
😎 Deploy Preview https://deploy-preview-17659--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@tay1orjones tay1orjones enabled auto-merge October 28, 2024 20:33
@tay1orjones tay1orjones added this pull request to the merge queue Oct 28, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 28, 2024
@kennylam kennylam added this pull request to the merge queue Oct 29, 2024
Merged via the queue into carbon-design-system:main with commit 800efdd Oct 29, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AILabel autoAlign does not work
4 participants