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

Choose a reason for hiding this comment

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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

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

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

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

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 commented May 11, 2018 via email

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

That does make sense. I made the discussed changes.

@jasongrout
Copy link
Member

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 modified the milestones: Minor release, 7.3 Jul 6, 2018
@jasongrout
Copy link
Member

@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

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

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

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

Thanks @piyushrungta25 for pushing this through!

@lock lock bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. 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.
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants