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

Prod 1974 language picker button breaks layout #4815

Merged
merged 7 commits into from
Apr 23, 2024

Conversation

gilluminate
Copy link
Contributor

@gilluminate gilluminate commented Apr 19, 2024

Closes PROD-1974

Description Of Changes

  1. Icon issue was caused by the lack of consistent border-box definitions
  2. Updated secondary buttons to have their own wrapper for better layout control, allowing us to fix the floating layout button issue

Code Changes

  • Added box-sizing: content-box to entire overlay for consistency
  • Removed individual box-sizing definitions that are now redundant because of the above change
  • Added box-sizing: border-box overrides to pseudo buttons as needed
  • Wrapped secondary buttons in own container and gave classes consistent with primary buttons for consistency.
  • Added min-height definition to secondary wrapper for when absolutely positioned language switcher was present. No longer relies on Privacy Policy link to be present for correct layout.

Steps to Confirm

Layout issue

  1. Visit fides.js demo site
  2. Open banners and modals with Privacy Policy url not being defined. These were the urls that were helpful to me to find all the variations.
    • /fides-js-demo.html?geolocation=us-ca
    • /fides-js-components-demo.html
    • /fides-js-demo.html?geolocation=eea
  3. ensure layout is not broken due to language button being outside of the document flow (absolute positioned).

Small icon issue

  1. visit cookie house site with new code published or use dev tools to apply the following css to the entire demo page (this is true of the cookie house site, and likely most of our client's sites as this is fairly standard)
    * {
      box-sizing: content-box;
    }
    
  2. ensure language switcher button's icons are unaffected

Pre-Merge Checklist

Copy link

vercel bot commented Apr 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fides-plus-nightly ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 23, 2024 1:51pm

@gilluminate gilluminate force-pushed the PROD-1974-language-picker-button-breaks-layout branch from 4b9f075 to 6932140 Compare April 19, 2024 14:40
Copy link

cypress bot commented Apr 19, 2024

Passing run #7411 ↗︎

0 4 0 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

Merge 5df4f71 into 7c93a73...
Project: fides Commit: 02599189de ℹ️
Status: Passed Duration: 00:35 💡
Started: Apr 23, 2024 2:01 PM Ended: Apr 23, 2024 2:02 PM

Review all test suite changes for PR #4815 ↗︎

Copy link
Contributor

@lucanovera lucanovera left a comment

Choose a reason for hiding this comment

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

Overall looks great. Just have a few suggestions for improvements.

@@ -75,6 +59,28 @@ export const ConsentButtons = ({
</Fragment>
)}
</div>
<div
className={`${
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you ever worked with the classNames npm package? (https://www.npmjs.com/package/classnames). I don't think we're using it on this project, but I bet it would make all of these conditional classes much easier. Give it a try if you can.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately we have to keep this codebase as tiny as possible since it ends up on the client's site and affects load time, so I hesitate adding a new convenience package like this.

i18n.availableLanguages?.length > 1 ? "fides-button-group-i18n" : ""
}`}
>
{i18n.availableLanguages?.length > 1 && (
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed we're checking this condition 2 times. I would consider having a variable like "showLanguageSelector".

display: flex;
flex-direction: column;
z-index: 5;
background-color: var(--fides-overlay-background-color);
bottom: 0px;
width: var(--fides-overlay-width);
width: calc(
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if this is necessary. It's parent "div.fides-modal-content" already has the overlay width set. So no ´width´ or width set to 100% should have the same result I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are correct. This change was necessary before I applied the box-sizing to the entire component. Before it was bleeding over with 100% set. I'll take another look now that it's more standard.

@@ -77,6 +81,10 @@ div#fides-overlay {
position: fixed;
}

div#fides-overlay * {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lucanovera Neville informed me that this ID isn't reliable, since our client's have an option to use their own ID. I'm going to add a bit of work to this PR to address that.

@gilluminate
Copy link
Contributor Author

@lucanovera Thank you for those suggestions! I made updates as applicable. Please review again at your earliest convenience. Thanks.

@gilluminate gilluminate force-pushed the PROD-1974-language-picker-button-breaks-layout branch from 5f80b8a to 6bde76e Compare April 22, 2024 20:08
Copy link
Contributor

@lucanovera lucanovera left a comment

Choose a reason for hiding this comment

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

Approved! Looks good, and I see you've applied my previous suggestions. Thanks!

@gilluminate gilluminate merged commit 32f4302 into main Apr 23, 2024
13 checks passed
@gilluminate gilluminate deleted the PROD-1974-language-picker-button-breaks-layout branch April 23, 2024 14:54
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.

2 participants