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

Regression from earlier version, inline Buttons are misplaced #2361

Closed
pascal-pfeiffer opened this issue Jul 2, 2024 · 3 comments · Fixed by #2390
Closed

Regression from earlier version, inline Buttons are misplaced #2361

pascal-pfeiffer opened this issue Jul 2, 2024 · 3 comments · Fixed by #2390
Labels
bug Bug in code ui Related to UI

Comments

@pascal-pfeiffer
Copy link

Wave SDK Version, OS

Wave v1.3.4

Actual behavior

From wave v1.0.0 to wave v1.3.4 the placement of buttons has regressed.

ui.inline(
        ui.button(
            name="b1",
            label="Button1",
            primary=False,
            width="150px",
        ),
        ui.button(
            name="b2",
            label="Button2",
            primary=False,
            width="150px",
        ),
        ui.button(
            name="b3",
            label="Button3",
            primary=True,
            width="200px",
        ),
        ui.button(
            name="b4",
            label="Button4",
            primary=False,
            width="200px",
        ),
        justify="start",
)

v1.3.4
image

Expected behavior

v1.0.0
image

@pascal-pfeiffer pascal-pfeiffer added the bug Bug in code label Jul 2, 2024
@marek-mihok
Copy link
Contributor

marek-mihok commented Jul 16, 2024

This behavior was introduced by #2273. As a temporary solution you can wrap buttons with ui.buttons() group :

from h2o_wave import main, app, Q, ui


@app('/demo')
async def serve(q: Q):
    q.page['example'] =  ui.form_card(
        box='1 1 -1 4', 
        items=[
            ui.inline(
                [ui.buttons([
                    ui.button(
                        name="b1",
                        label="Button1",
                        primary=False,
                        width="150px",
                    ),
                    ui.button(
                        name="b2",
                        label="Button2",
                        primary=False,
                        width="150px",
                    ),
                    ui.button(
                        name="b3",
                        label="Button3",
                        primary=True,
                        width="200px",
                    ),
                    ui.button(
                        name="b4",
                        label="Button4",
                        primary=False,
                        width="200px",
                    )
                ])],
                justify="start",
            ),     
        ]
    )
    await q.page.save()
image

@marek-mihok
Copy link
Contributor

The issue is caused by standalone button having buttons group styles applied which conflicts with styles applied by #2273.

  XStandAloneButton = ({ model: m }: { model: Button }) => (
    <div className={css.buttons}>
      <XButton key={m.name} model={m} />
    </div>
  ),

Other components should not be affected.

@pascal-pfeiffer
Copy link
Author

Thank you @marek-mihok! The quick fix with wrapping the single buttons in a ui.buttons() group did the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug in code ui Related to UI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants