-
-
Notifications
You must be signed in to change notification settings - Fork 902
Segment direct&inherited properties/methods in reference documentation to enhance readability #5484
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
Segment direct&inherited properties/methods in reference documentation to enhance readability #5484
Conversation
|
Thanks @himbeles for your PR. It is a good initiative, and I am in agreement to showing the inheritance. But this makes the list even more unwieldy though (eyeball: +50% length increase?).
I have said somewhere that the binding methods are a bit long in the documentation, but never got around to fixing it. I think we can cherish this opportunity for the cleanup. Idea: could a tabbed interface make it more clear? Inspiration from Quasar
|
|
We could skip the markers per property in my PR. At least there would already be the segmentation into two categories. I think you would already gain a lot with this minor change. Unfortunately, I don't have the bandwidth to do something much more sophisticated, like the tabbed interface (which I like). |
|
Maybe I can make it tabbed. It might just work! |
|
On that note, the inherited props which are listed essentially on every component documentation page also mess with web search results. Say you are searching for 'nicegui add_slot' on google. The first results tend to be a random list of components which all include the same documentation. Instead, you would hope to land on ui.element where the method is actually defined. Perhaps there is a way here to fix this, e.g. with the tabbed interface where only the "main" tab is indexed per component... |
|
Indeed, hiding the inherited props in a (default-hidden) tab may help with indexing, but that's certainly not all we can do. SEO has been a challenging topic. Let's have a review:
If you want to help you can check out #5308 first. I have some ideas for reigniting #4557 without invoking nodejs but let's leave it for later. |
|
Hmm, I think this does not work really well: A simple alternative to make the lists more manageable without introducing "handcrafted" category labels could be to have tabs for methods and properties, not for direct vs. inherited. Then within each tab, you'd have the flat list for direct members, followed by inherited members, as proposed by me. What do you think? |
|
Concerning SEO, I'm no expert either, unfortunately... |
|
I think the code for tabbed interface work on logic side, what is holding it back is UI design. It lacks visual distinctiveness and is a bit easy to miss, especially when an element only inherits. We may need some (possibly long) time to work on it. The project will possibly be of scale similar to #5044. And so, right now I think we can keep that commit's code safely somewhere while we roll it back. For the vertical height issue, I think it's still a valid concern. Maybe the inheritance label can be shown on the right, so as to not consume more that what was originally there? |
|
Yes, my proposal was to skip these class inheritance markers per member completely. Just to keep the segmentation. But we can play with putting it right aligned ... |
d33f251 to
3e8e24a
Compare
This comment was marked as resolved.
This comment was marked as resolved.
|
My two cents:
|
|
Fair point about suddenly introducing tabs and breaking Ctrl+F expectations. There are ways to circumvent (GitHub actions log view implements custom search when click Ctrl+F) but it'll be a lot of work (NiceGUI 4.0 documentation page refresh?)
Anyways I hope my divider is enough space-saving already. Bonus item for later: "Skip to main content" for NiceGUI documentation site? |
|
Hi @evnchn, I think I'd still prefer a single divider (or just header) between direct and all inherited props combined. The division into all of the parent classes makes it quite cluttered without providing much benefit. Particularly given the names of the parent classes without further explanation or linked definition of these classes... |
|
Ok no problem, but then do we sort by alphabetically (more like original code) or sort by inheritance then alphabetical (more like current code)? |
fe21800 to
510c4d2
Compare
can relate :) |
|
Looks better than family_history? Material Symbols, so do |
|
Both look good to me. Feel free to decide! |
Co-authored-by: Evan Chan <[email protected]>
|
@himbeles I don't think this is in-progress anymore? We are pretty done with it? Please 👍 if you agree. |
falkoschindler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @himbeles and @evnchn for this contribution! It turned out rather nicely!
I just refactored the code a little, e.g. replacing tuples with a dataclass. And I felt like wrapping inherited attributes in expansion items that are open by default. This makes them appear less subtle and even allows to hide them to focus on native attributes.
Let's merge!
Yes, I thought about it. But customizing the expansion header is non-trivial and I considered it good enough. 🤷🏻♂️ |
|
|
Done: 13b4c23 ✔️
Once in a while NiceGUI still surprises me... 😄 |






Motivation
Proposal:
This PR segments the properties and methods in the documentation into direct class properties/methods first, then an “Inherited” subsection with bracketed gray notes on the originating class.
(At least for me) This significantly improves the readability of the reference documentation, surfacing the direct features, before the large amount of inherited ones which are common between most components.
See, for example, the first properties of

ui.tableBefore, they were interleaved with
client,classes, etc.Now, they are in a dedicated section directly after:

Implementation
Modification of
website/documentation/reference.pywhere the ancestor classes - already part ofmro-- are surfaced in the documentation markdown. Segmentation of properties and methods into direct and inherited ones is based on these values, too.Progress