Skip to content

Conversation

@juanmitriatti
Copy link
Contributor

@juanmitriatti juanmitriatti requested a review from a team as a code owner March 13, 2025 19:02
@juanmitriatti juanmitriatti changed the title fix(component-events): added style to fix a:focus UDS-1975: fix(component-events): added style to fix a:focus Mar 13, 2025
@asu-jenkins-devops
Copy link
Collaborator

Copy link
Member

@mlsamuelson mlsamuelson left a comment

Choose a reason for hiding this comment

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

Fix is causes layout shift when the images and links are focused. Are we able to use the same technique as with other focus instances so we avoid that?

@juanmitriatti
Copy link
Contributor Author

Fix is causes layout shift when the images and links are focused. Are we able to use the same technique as with other focus instances so we avoid that?

I added margin: 4px to make the box-shadow visible on focus. Without this margin, the wrapper tag (for example, in the h3 of the title) hides it, causing the 'movement' effect when focusing. Also, display: inline-block ensures that the box-shadow applies globally rather than per line.

With display: inline-block
image

Without
image

@davidornelas11
Copy link
Contributor

@mlsamuelson The overflow hidden on the parent h3 causes the shadow to not appear. The hidden is there because the heading shouldn't pass 3 lines so that's necessary

@mlsamuelson
Copy link
Member

Is there any way we can accomplish this without the layout shifting when focus occurs? What are our options?

If we can't change it, we will need to have The Brand team review the behavior for acceptability.

@juanmitriatti
Copy link
Contributor Author

Is there any way we can accomplish this without the layout shifting when focus occurs? What are our options?

If we can't change it, we will need to have The Brand team review the behavior for acceptability.

The box-shadow on focus extends beyond the element’s box, but since overflow: hidden is applied, it gets clipped. We can’t make it visible without adding a margin, and adding it causes the layout shift.

@juanmitriatti
Copy link
Contributor Author

juanmitriatti commented Mar 20, 2025

Hi @mlsamuelson , @davidornelas11
I found a possible solution: add margin: 4px and display: inline-block to the a .card-title styles to ensure the box shadow is visible, and remove these styles from a:focus.
The problems/concerns that we've here are :

  • Image left border does not show up (it's because the wrapper class has overflow: hidden) . (Please check first image attached)
    In order to fix this, we could add margin: 0 4px to the wrapper ul classes. (Please check second image attached).

  • On the other hand, all the titles will have margin: 4px.

  1. First image:
    WhatsApp Image 2025-03-20 at 10 30 54

  2. Second image:

WhatsApp Image 2025-03-20 at 10 45 27

@mlsamuelson
Copy link
Member

I'm less concerned with the images, and more concerned with the text - that should be preventable. If we can avoid the text from shifting, then I'm okay with allowing the images to shift some.

@mlsamuelson
Copy link
Member

Conversation on this here

@davidornelas11
Copy link
Contributor

This has been tested and double checked by Alysia on the brand team. Looks good. Will approve and merge

davidornelas11
davidornelas11 previously approved these changes Apr 21, 2025
@davidornelas11 davidornelas11 merged commit adfaa8f into dev Apr 21, 2025
@davidornelas11 davidornelas11 deleted the UDS-1975 branch April 21, 2025 21:21
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.

5 participants