Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mayagbarnes
Copy link
Collaborator

@mayagbarnes mayagbarnes commented Mar 6, 2025

Describe your changes

As part of refactor to remove passing explicit width prop down to each element (see PR #10342), some breakage occurred in button commands (st.button, st.link_button, st.download_button, st.form_submit_button, etc.) when using the help param.

Main changes:

  • Tooltip.tsx: we pass a prop, containerWidth, down to the tooltip wrapper div so that if containerWidth is true, its width is "100%", otherwise set width to "auto". Previously we always set the width to 100%. This prop is passed from button command > BaseButtonTooltip > TooltipIcon > Tooltip.

Note: We used to use a fluidWidth concept when useContainerWidth was true & using help, which required passing the container width down to the button to render properly. Since we are no longer passing width down, simplifying by renaming to containerWidth to control rendering width at 100% or auto.

Also....visual breakage in st.page_link outside of the help param result of MPAv1/v2 refactor (currentPageScriptHash not being set in SPA) - will file separate issue for that.

GitHub Issue Link (if applicable)

Closes #10648
Closes #10656

Testing Plan

  • Unit Tests (JS and/or Python): ✅ Added
  • E2E Tests: ✅ Added
  • Manual Testing: ✅

@mayagbarnes mayagbarnes added security-assessment-completed Security assessment has been completed for PR change:bugfix PR contains bug fix implementation impact:users PR changes affect end users labels Mar 6, 2025
@mayagbarnes mayagbarnes changed the title [WIP] [Fix]: Button commands breakage with help [Fix]: Button commands breakage with help Mar 6, 2025
@mayagbarnes mayagbarnes marked this pull request as ready for review March 6, 2025 05:38
Copy link
Collaborator

@sfc-gh-bnisco sfc-gh-bnisco left a comment

Choose a reason for hiding this comment

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

Great PR description! Thank you for the fixes and the added tests, LGTM after CI passes 👍

@mayagbarnes mayagbarnes merged commit 78908b1 into develop Mar 6, 2025
32 of 33 checks passed
@mayagbarnes mayagbarnes deleted the fix-10648 branch March 6, 2025 08:21
sfc-gh-lwilby pushed a commit that referenced this pull request Mar 6, 2025
As part of refactor to remove passing explicit width prop down to each element (see PR
#[10342](#10342)), some breakage occurred in button commands (`st.button`, `st.link_button`, `st.download_button`, `st.form_submit_button`, etc.) when using the `help` param.

* `Tooltip.tsx`: we pass a prop, `containerWidth`, down to the tooltip wrapper div so that if `containerWidth` is true, its width is `"100%"`, otherwise set width to `"auto"`. Previously we always set the width to 100%. This prop is passed from button command > `BaseButtonTooltip` > `TooltipIcon` > `Tooltip`.

We used to use a `fluidWidth` concept when `useContainerWidth` was true & using `help`, which required passing the container width down to the button to render properly. Since we are no longer passing width down, simplifying by renaming to `containerWidth` to control rendering width at `100%` or `auto`.
sfc-gh-lwilby pushed a commit that referenced this pull request Mar 7, 2025
As part of refactor to remove passing explicit width prop down to each element (see PR
#[10342](#10342)), some breakage occurred in button commands (`st.button`, `st.link_button`, `st.download_button`, `st.form_submit_button`, etc.) when using the `help` param.

* `Tooltip.tsx`: we pass a prop, `containerWidth`, down to the tooltip wrapper div so that if `containerWidth` is true, its width is `"100%"`, otherwise set width to `"auto"`. Previously we always set the width to 100%. This prop is passed from button command > `BaseButtonTooltip` > `TooltipIcon` > `Tooltip`.

We used to use a `fluidWidth` concept when `useContainerWidth` was true & using `help`, which required passing the container width down to the button to render properly. Since we are no longer passing width down, simplifying by renaming to `containerWidth` to control rendering width at `100%` or `auto`.
mayagbarnes added a commit that referenced this pull request Mar 11, 2025
…10690)

Ensure `currentPageScriptHash` set in `App` & populated in `LibContext` for SPA - `currentPageScriptHash` blank for SPAs - so `st.page_link` renders every page as if its the current page:
    
Fix styling for `st.page_link` when `help` & `use_container_width = "true"` - [#10640](#10658) addresses part of the issue with width for `st.page_link` but also need to handle width in `StyledNavLinkContainer`

Add dedicated e2e/snapshot testing for `st.page_link` feature (currently only in MPA context) - currently have page link buttons in MPA tests, but to prevent issues in the future, adding SPA tests for `st.page_link`

Add more JS unit tests for `st.page_link` params like `icon`, `help`, `use_container_width`, etc.
sfc-gh-mbarnes pushed a commit that referenced this pull request Mar 11, 2025
…10690)

Ensure `currentPageScriptHash` set in `App` & populated in `LibContext` for SPA - `currentPageScriptHash` blank for SPAs - so `st.page_link` renders every page as if its the current page:

Fix styling for `st.page_link` when `help` & `use_container_width = "true"` - [#10640](#10658) addresses part of the issue with width for `st.page_link` but also need to handle width in `StyledNavLinkContainer`

Add dedicated e2e/snapshot testing for `st.page_link` feature (currently only in MPA context) - currently have page link buttons in MPA tests, but to prevent issues in the future, adding SPA tests for `st.page_link`

Add more JS unit tests for `st.page_link` params like `icon`, `help`, `use_container_width`, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:bugfix PR contains bug fix implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Button gets full width if it has a help/tooltip adding the help parameter to a (Button?) widget pads it weirdly instead of staying to the left.

4 participants