carbon icon indicating copy to clipboard operation
carbon copied to clipboard

fix: ailabel autoalign was not working

Open preetibansalui opened this issue 1 year ago β€’ 6 comments

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 avatar Oct 07 '24 06:10 preetibansalui

Deploy Preview for carbon-elements ready!

Name Link
Latest commit dd53e95eb3177d98be802764502c28184b0e23d4
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.

netlify[bot] avatar Oct 07 '24 06:10 netlify[bot]

Deploy Preview for v11-carbon-react ready!

Name Link
Latest commit dd53e95eb3177d98be802764502c28184b0e23d4
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.

netlify[bot] avatar Oct 07 '24 06:10 netlify[bot]

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 :warning:
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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 07 '24 07:10 codecov[bot]

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

tay1orjones avatar Oct 07 '24 19:10 tay1orjones

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.

preetibansalui avatar Oct 09 '24 05:10 preetibansalui

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

Name Link
Latest commit dd53e95eb3177d98be802764502c28184b0e23d4
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.

netlify[bot] avatar Oct 17 '24 12:10 netlify[bot]