Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: Make event handling table scrollable #24752

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

Merged
merged 1 commit into from
Dec 22, 2022

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Dec 17, 2022

PR Summary

The existing table is too wide, and overflow is clipped, so that not all toolkits are visible.

Fixes (partially?) #24741

I also changed Nothing to *nothing* to make it clearer and added a *nothing* to the macosx table for AltGr.

PR Checklist

Documentation and Tests

  • [n/a] Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • [n/a] New plotting related features are documented with examples.

Release Notes

  • [n/a] New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • [n/a] API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • [n/a] Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

@QuLogic
Copy link
Member Author

QuLogic commented Dec 17, 2022

After writing this PR description, I realized we should probably mark these keys with :kbd:.

@QuLogic QuLogic force-pushed the event-handling-tabs branch from 36b0e5b to 0a4b07e Compare December 17, 2022 05:20
Copy link
Contributor

@greglucas greglucas left a comment

Choose a reason for hiding this comment

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

I like this styling, and especially the :kbd: addition!

Some minor nits if you're able:

  • Switching between tabs the width of the columns changes and jumps around a bit, so can you fix the width of the columns relative to the maximum somehow?
  • Keyboard keys with a + in them show up as bold for me and are also inset a couple of points relative to the non multi-keys. Would be nice to get all of that consistent too.

:kbd:`Shift` shift
:kbd:`Control` control
:kbd:`Alt` alt
:kbd:`AltGr` *nothing*
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these actually nothing or are they unknown? For example, I filled out most of the macosx section and I just don't have an AltGr key, so I just had no idea what it produces :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know actually, so I've reverted it to be empty.

@tacaswell tacaswell modified the milestones: v3.8.0, v3.7.0 Dec 18, 2022
Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

lost gtk

@timhoffm
Copy link
Member

I agree that a clipped table is not feasible. However, the tabs are not very good from a usability perspective either. The table is about inconsistencies between the backends. The key information is the comparison between the backends. This is quite complicated if you can only see one backend at a time.

We should think about other alternatives, e.g. (I'm not a CSS expert) could one make a button that let's the table element expand to the right and float over the right side bar? Or maybe a button to pop it out as an overlay similar to the search field.

Side note: I find the very limited horizontal space in the pydata-sphinx-theme quite annoying. Are there no other projects that need more horizontal space from time to time? Maybe we should bring the topic back to pydata-sphinx-theme and discuss possible solutions with them.

@QuLogic
Copy link
Member Author

QuLogic commented Dec 20, 2022

  • Switching between tabs the width of the columns changes and jumps around a bit, so can you fix the width of the columns relative to the maximum somehow?

I tried making the columns the same width in the source, but that didn't seem to fix it in the result.

  • Keyboard keys with a + in them show up as bold for me and are also inset a couple of points relative to the non multi-keys. Would be nice to get all of that consistent too.

That's just how Sphinx produces them; they get nested <kbd> tags, and I guess the theme sets it up in a way that the style stacks. I would guess we should report that to pydata-sphinx-theme?

We should think about other alternatives, e.g. (I'm not a CSS expert) could one make a button that let's the table element expand to the right and float over the right side bar? Or maybe a button to pop it out as an overlay similar to the search field.

It is relatively simple to add a horizontal scroll bar to the note if it is too large. We could also have the overflow appear on hover, but I'm not sure how well that works on small screens. I think I've seen a similar thing on code blocks in places. The button idea is more complicated, as I expect it would need JavaScript to implement.

@greglucas
Copy link
Contributor

Keyboard keys with a + in them show up as bold for me and are also inset a couple of points relative to the non multi-keys. Would be nice to get all of that consistent too.

That's just how Sphinx produces them; they get nested <kbd> tags, and I guess the theme sets it up in a way that the style stacks. I would guess we should report that to pydata-sphinx-theme?

Yeah, I think so, it definitely looks odd to me, but no need to change it here. They are better than before.

It is relatively simple to add a horizontal scroll bar to the note if it is too large.

If we are going back to the horizontal scroll bar, I think it would be nice to freeze the first column as well then. That first column is the independent variable here that we sort of need to understand everything else.

@QuLogic
Copy link
Member Author

QuLogic commented Dec 21, 2022

I believe there is a way to scroll and keep the first column, but in order to do that, we need to actually mark the first column differently. The only way to do this in reST is to make it a list-table and specify the stub-columns option. This will mark them as th instead of td.

@QuLogic QuLogic force-pushed the event-handling-tabs branch from 0a4b07e to 5eb62a6 Compare December 21, 2022 09:08
@QuLogic
Copy link
Member Author

QuLogic commented Dec 21, 2022

This should work like that now, I believe. Unfortunately, the whole note scrolls a little bit before the first column becomes sticky, and I don't know a way to fix that. But this is probably better than before.

@greglucas
Copy link
Contributor

I wasn't able to get it to freeze/stick the first column for me? Another thing to consider is re-ordering the items to have the more commonly used/extended toolkits up front, having QT and Tk be the first two columns I'd guess.

@tacaswell
Copy link
Member

I would go with the order [tk, qt, macosx, webagg, gtk, wxpython].

@QuLogic
Copy link
Member Author

QuLogic commented Dec 22, 2022

I wasn't able to get it to freeze/stick the first column for me?

Ah, oops, I missed copying something something from build back to the source.

The existing table is too wide, and overflow is clipped, so that not all
toolkits are visible.

Also, wrap all the entered keys in `:kbd:`, and re-sort the columns.

Fixes matplotlib#24741
@QuLogic QuLogic force-pushed the event-handling-tabs branch from 5eb62a6 to 542f325 Compare December 22, 2022 04:26
@QuLogic
Copy link
Member Author

QuLogic commented Dec 22, 2022

I moved the table into a div with a wide-table class instead of relying on the note's div. This means the CSS may be reused for other places if we have any by wrapping the table in a container (but I believe there aren't any other places.)

Also reordered the columns.

@tacaswell
Copy link
Member

@tacaswell tacaswell merged commit b62376c into matplotlib:main Dec 22, 2022
@QuLogic QuLogic deleted the event-handling-tabs branch December 22, 2022 20:36
@QuLogic QuLogic changed the title DOC: Change event handling table into a tab set DOC: Make event handling table scrollable Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants