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(quantic): Sort dropdown and tooltip partially hidden by Salesforce container #4028

Closed
wants to merge 8 commits into from

Conversation

SimonMilord
Copy link
Contributor

@SimonMilord SimonMilord commented May 29, 2024

SFINT-5552

  • For all issues: The main culprit was the component container in Salesforce. We don't have control over that and it also makes it virtually impossible to precisely know where the end of the container is since Salesforce doesn't seem to allow us to target it. So we can't quite use JS to get coordinates of elements and do some math to figure out when the component is hidden or not.... I therefore had to find crafty solutions...

ISSUE 1: Sort component

Before:

image

After:

Screenshot 2024-05-29 at 4 17 18 PM

Solution:

  • The lightning-combobox had the class: slds-dropdown_fluid automatically added by Salesforce which was adding the following properties: min-width 12rem, max-width: 100% and width: 100% which was causing the dropdown to overflow on the container.
  • The solution here is essentially to create a CSS class sort__combobox which overrides the properties set by slds-dropdown_fluid. I could not just remove the min-width, because then the labels would be truncated.

ISSUE 2: Toggle for GEN AI

Before:

image

After:

Screenshot 2024-05-29 at 12 31 50 PM Screenshot 2024-05-29 at 12 32 06 PM

Solution:

  • The solution found here was to change the label to something shorter so that it doesn't get hidden. I replaced the old label by ON/OFF since its already pretty obvious we are talking of the generatedAnswer component.
  • Why I think this is acceptable: We will eventually remove this toggle button so why overthink this and also the copy to clipboard label : copy is also small enough to not get hidden when we do remove the toggle.

ISSUE 3: Tooltips getting partially hidden on the top

Will be fixed in a seperate PR in the C4SF package

Copy link

github-actions bot commented May 29, 2024

Pull Request Report

PR Title

❌ Title should follow the conventional commit spec:

(optional scope):

Example:

feat(headless): add result-list controller

Bundle Size

File Old (kb) New (kb) Change (%)
case-assist 202.8 202.8 0
commerce 285.5 285.5 0
search 367.4 367.4 0
insight 347.8 347.8 0
product-listing 262.3 262.3 0
product-recommendation 171.9 171.9 0
recommendation 215.8 215.8 0
ssr 360.3 360.3 0

SSR Progress

Use case SSR (#) CSR (#) Progress (%)
search 39 44 89
recommendation 0 4 0
product-recommendation 0 10 0
product-listing 0 13 0
case-assist 0 6 0
insight 0 27 0
commerce 0 7 0
Detailed logs search : buildInteractiveResult
search : buildInteractiveInstantResult
search : buildInteractiveRecentResult
search : buildInteractiveCitation
search : buildGeneratedAnswer
recommendation : missing SSR support
product-recommendation : missing SSR support
product-listing : missing SSR support
case-assist : missing SSR support
insight : missing SSR support
commerce : missing SSR support

@SimonMilord SimonMilord marked this pull request as ready for review May 29, 2024 20:53
@SimonMilord SimonMilord requested a review from a team as a code owner May 29, 2024 20:53
Copy link
Contributor

@mmitiche mmitiche left a comment

Choose a reason for hiding this comment

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

Solutions 1 and 2 look good to me, however I disagree with solution 3.

I don't think we should change the behaviour/design of the tooltip because of a padding issue, I would qualify this as a minor issue that I think we could easily find ways around it without making significant changes in our components.

In the Quantic components, one of the goals is to create components that have the same look and feel as native Salesforce components.
Thus, when building/modifying Quantic components our reference is the SLDS design system and not Atomic.

In the SLDS design system, the tooltip is presented as the following: https://www.lightningdesignsystem.com/components/tooltips/
We should not get far from the tooltip behaviour inside Salesforce by removing the arrow.

Copy link

github-actions bot commented May 30, 2024

Pull Request Report

PR Title

❌ Title should follow the conventional commit spec:
<type>(optional scope): <description>

Example: feat(headless): add result-list controller

Live demo links

Bundle Size

File Old (kb) New (kb) Change (%)
case-assist 202.8 202.8 0
commerce 285.9 285.9 0
search 367.5 367.5 0
insight 347.8 347.8 0
product-listing 262.3 262.3 0
product-recommendation 171.9 171.9 0
recommendation 215.8 215.8 0
ssr 360.3 360.3 0

SSR Progress

Use case SSR (#) CSR (#) Progress (%)
search 39 44 89
recommendation 0 4 0
product-recommendation 0 10 0
product-listing 0 13 0
case-assist 0 6 0
insight 0 27 0
commerce 0 7 0
Detailed logs search : buildInteractiveResult
search : buildInteractiveInstantResult
search : buildInteractiveRecentResult
search : buildInteractiveCitation
search : buildGeneratedAnswer
recommendation : missing SSR support
product-recommendation : missing SSR support
product-listing : missing SSR support
case-assist : missing SSR support
insight : missing SSR support
commerce : missing SSR support

@@ -10,7 +10,7 @@
<lightning-formatted-text value={labels.sortBy}></lightning-formatted-text>
</lightning-layout-item>
<lightning-layout-item>
<lightning-combobox name="sort" value={value} variant="label-hidden" label={labels.sortBy} placeholder={labels.relevancy} options={options} onchange={handleChange}>
<lightning-combobox class="sort__combobox" name="sort" value={value} variant="label-hidden" label={labels.sortBy} placeholder={labels.relevancy} options={options} onchange={handleChange}>
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure how is this CSS class is overriding the Salesforce CSS class defined inside the lightning-combobox component since this class you are adding is in a higher level than the SF class. are you sure it is overriding it?

Copy link
Contributor

Choose a reason for hiding this comment

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

In another note I suggest trying the following solution to see if it works:

The lightning-combobox component has a public property called: dropdown-alignment it specifies where the drop-down list is aligned. One of the values that this property could take is auto which will let the component determine where to open the list based on space available.
So it's worth trying to see if this component by it self is able to adapt according to the SF boundaries.

ref: https://developer.salesforce.com/docs/component-library/bundle/lightning-combobox/specification

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Yes I checked it is overriding it.

  2. I already tried that when I was experimenting with the potential idea to make it dynamically aligned-right and auto doesnt work :( It was still overflowing... I think it might not account properly for the side of the container or something

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yea I would suggested replacing simply the dropdown-alignment to set it to dropdown-alignment="right" It makes more sense that the dropdown fits by being right aligned instead of limiting the width etc.

Copy link
Collaborator

@erocheleau erocheleau left a comment

Choose a reason for hiding this comment

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

The thing that's hiding the overflow btw is the .hosted-search-page_layout[c-hostedSearchPageRenderer_hostedSearchPageRenderer] This is the class that has the overflow: hidden on it, so I don't know why we can't just change that?

@@ -10,7 +10,7 @@
<lightning-formatted-text value={labels.sortBy}></lightning-formatted-text>
</lightning-layout-item>
<lightning-layout-item>
<lightning-combobox name="sort" value={value} variant="label-hidden" label={labels.sortBy} placeholder={labels.relevancy} options={options} onchange={handleChange}>
<lightning-combobox class="sort__combobox" name="sort" value={value} variant="label-hidden" label={labels.sortBy} placeholder={labels.relevancy} options={options} onchange={handleChange}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yea I would suggested replacing simply the dropdown-alignment to set it to dropdown-alignment="right" It makes more sense that the dropdown fits by being right aligned instead of limiting the width etc.

@@ -1409,14 +1413,14 @@
</labels>
<labels>
<fullName>quantic_GeneratedAnswerOn</fullName>
<value>Generated answer ON</value>
<value>ON</value>
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can't change the values just because they'd fit better xD

Also please don't run prettier on this file it looks stupid to have text on multiple lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants