h2oai / wave

Realtime Web Apps and Dashboards for Python and R
https://wave.h2o.ai
Apache License 2.0
3.9k stars 327 forks source link

Label of the ui.copyable_text is not an optional field #2012

Closed kajanan1212 closed 1 year ago

kajanan1212 commented 1 year ago

Wave SDK Version, OS

Wave SDK: 0.25.3 , OS: MacOs

Actual behavior

Label of the ui.copyable_text is not an optional field. Therefore, we should provide a label as below.

Screenshot 2023-06-08 at 15 09 25



If we try to avoid the label by giving an empty/space string to it then copy icon of the ui.copyable_text will move little bit down from the top right corner as below.

Screenshot 2023-06-08 at 15 09 06

Expected behavior

Label of the ui.copyable_text should be an optional field.

OR

Giving an empty/space string to the label of the ui.copyable_text shouldn't move the icon from the top right corner.

Steps To Reproduce

You can run the following code to create the issue:

from h2o_wave import main, app, Q, ui

@app('/')
async def serve(q: Q):

    q.page['card_1'] = ui.form_card(
        box='1 1 4 3',
        items=[
            ui.copyable_text(
                value="*"*100,
                label="",
                multiline=True,
                height="100px",
            ),
        ]
    )

    await q.page.save()
mturoci commented 1 year ago

Correct, label is not optional as can be seen in API. Providing a copyable_text without a proper label is not a good idea UX-wise since user needs to know what it is that they are about to copy.

kajanan1212 commented 1 year ago

When we give an empty/space string to the label, the copy icon of the ui.copyable_text moves a little down from the top right corner.

@mturoci is it not a bug?

mturoci commented 1 year ago

As said in the comment above, the label should always be provided. Icon moving a little down is not desired, but not worth the time fixing + prevents bad UX as bonus now so win-win.