Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Expose Dropdown option 'title' property #793

Merged
merged 12 commits into from
Apr 30, 2020
Merged

Expose Dropdown option 'title' property #793

merged 12 commits into from
Apr 30, 2020

Conversation

wbrgss
Copy link
Contributor

@wbrgss wbrgss commented Apr 15, 2020

The HTML property title is already available upstream in react-virtualized-select:

https://github.com/bvaughn/react-virtualized-select/blob/master/source/VirtualizedSelect/VirtualizedSelect.js#L186

So I exposed it in the Dropdown component as a solution was requested by @KPhans:

is there a way to have hover descriptions of dropwdown selections?

If the core team is on board with this I'll add an integration test and a docs example.

Demo:

title

@chriddyp
Copy link
Member

I like it!

Copy link
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet left a comment

Choose a reason for hiding this comment

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

💃 @wbrgss Just add a changelog entry for the additional nested prop and ready to merge.

@wbrgss
Copy link
Contributor Author

wbrgss commented Apr 15, 2020

@Marc-Andre-Rivet I would appreciate a review on c38eb00; I'm writing integration tests in another project and a review might help educate me on any bad practices I should correct

I'll leave docs to another issue https://github.com/plotly/dash-docs/issues/855

@KPhans
Copy link

KPhans commented Apr 15, 2020

If this is done by tmrw we can implement this for our customer 😊

dropdown_option_element.get_attribute("title"),
"The Big Apple",
),
)
Copy link
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet Apr 15, 2020

Choose a reason for hiding this comment

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

@wbrgss I'm not sure why there's a callback to update the title on the 1st option: If all we want to do is make sure it's present, we could set it in the initial layout. If we want to make sure it's present after an update, we should change it more than once and make sure it changes None --> "Big Apple" --> "Knicks Game" --> None for example.

I'm ok with us not testing further (eg. title present in the dropdown, not just the selected value) as that would be the same as testing the 3rd party component that we're wrapping.


Using wait_for_element instead of find_element_by_css_selector makes for a slightly more verbose test but also for a slightly more resilient test (eg. timing issues in CI). That said the test app is pretty small and probably will rarely be an issue. Same goes for wait_for vs. simply getting the attribute. This is 👌

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we want to make sure it's present after an update, we should change it more than once and make sure it changes None --> "Big Apple" --> "Knicks Game" --> None for example.

Agreed, that makes sense. I'll update it.

makes for a slightly more verbose test but also for a slightly more resilient test

Yeah, I've had timing issues here and there with more complicated test apps so I've been using wait_for for overkill to be safe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we want to make sure it's present after an update, we should change it more than once and make sure it changes None --> "Big Apple" --> "Knicks Game" --> None for example.

@Marc-Andre-Rivet I've done this in d5bee5d; if that looks right to you I'm going to merge.

@alexcjohnson
Copy link
Collaborator

@wbrgss looks like this one should be easy to wrap up for inclusion in the upcoming release?

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

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

💃 looks great!

@wbrgss wbrgss merged commit 3283a07 into dev Apr 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants