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

Add tooltip attribute to description widgets #1864 #2070

Merged
merged 5 commits into from Jul 6, 2018

Conversation

@piyushrungta25
Copy link
Contributor

@piyushrungta25 piyushrungta25 commented May 10, 2018

for #1864

@@ -65,14 +67,19 @@ class DescriptionView extends DOMWidgetView {

updateDescription() {
let description = this.model.get('description');
let tooltip = this.model.get('tooltip');
if (tooltip.length === 0) {
tooltip = description;
Copy link
Member

@jasongrout jasongrout May 10, 2018

How would we disable the tooltip if we didn't want it to show up?

Copy link
Contributor Author

@piyushrungta25 piyushrungta25 May 10, 2018

As far as I understand, it couldn't be disabled completely previously also since it always defaults to the description. Not specifying the tooltip or setting it to an empty string will result in closest behavior.

@jasongrout
Copy link
Member

@jasongrout jasongrout commented May 10, 2018

Thanks! One design comment about disabling the tooltip if we'd like. Setting the tooltip to '' seems natural to disable it - perhaps None should be the default, which means take it from the description?

I agree that this change is strictly better than what we have (we can't turn off tooltips right now either).

@jasongrout
Copy link
Member

@jasongrout jasongrout commented May 10, 2018

Also, can we call it description_tooltip? An arbitrary control might have other places where tooltips make sense, so scoping the name to where it is used makes sense, even if it is a bit long. We do have precedence for a name like that, in that the style has a description_width attribute.

@piyushrungta25
Copy link
Contributor Author

@piyushrungta25 piyushrungta25 commented May 10, 2018

Thanks for the feedback.

Setting the tooltip to '' seems natural to disable it - perhaps None should be the default, which means take it from the description?

Just so that I understand correctly, the new behavior should be,

  • tooltip = None, use description
  • tooltip = '' , disable tooltip

with None as the default value.

@jasongrout
Copy link
Member

@jasongrout jasongrout commented May 10, 2018

Does that make sense to you as a user? It's a bit awkward that we use "None" as a default value, but it is a convention. The way I see it, if you have a string, set the tooltip to that (including ''). If you have None, do the default behavior.

@maartenbreddels
Copy link
Member

@maartenbreddels maartenbreddels commented May 11, 2018

If widget.description_tooltip is set to a string(including empty string), the
tooltip is set to that. If it is set as None, use description string as default
value.
@piyushrungta25
Copy link
Contributor Author

@piyushrungta25 piyushrungta25 commented May 11, 2018

That does make sense. I made the discussed changes.

@jasongrout
Copy link
Member

@jasongrout jasongrout commented Jul 6, 2018

Thanks. We'll need to update the spec to have this trait, then I think we are good to merge. I'll look at this hopefully tomorrow.

@jasongrout jasongrout added this to the Minor release milestone Jul 6, 2018
@jasongrout jasongrout removed this from the Minor release milestone Jul 6, 2018
@jasongrout jasongrout added this to the 7.3 milestone Jul 6, 2018
@jasongrout
Copy link
Member

@jasongrout jasongrout commented Jul 6, 2018

@SylvainCorlay - what are your thoughts about the model change here? In particular, the attribute can be either null or a string - does that make things difficult for xwidgets?

@SylvainCorlay
Copy link
Member

@SylvainCorlay SylvainCorlay commented Jul 6, 2018

Hey @jasongrout thanks for the heads up.

The model changes are fine with me. We handle optional widget attributes very well in xwidgets.

For example, in the layout widget, we do:

XPROPERTY(xtl::xoptional<std::string>, derived_type, align_items, {}, XEITHER_OPTIONAL("flex-start", "flex-end", "center", "baseline", "stretch", "inherit", "inital", "unset"));

@jasongrout
Copy link
Member

@jasongrout jasongrout commented Jul 6, 2018

Great, then I'm okay with merging this for the beta.

@jasongrout jasongrout merged commit c8b6be6 into jupyter-widgets:master Jul 6, 2018
1 check passed
@jasongrout
Copy link
Member

@jasongrout jasongrout commented Jul 6, 2018

Thanks @piyushrungta25 for pushing this through!

@lock lock bot added the resolved-locked label May 21, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants