-
Notifications
You must be signed in to change notification settings - Fork 147
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
Improve dashboard title #228
Conversation
vizro-core/changelog.d/20231218_204302_antony.milne_improve_dashboard_title.md
Show resolved
Hide resolved
module=page.id, name=page.title, path=path, order=order, layout=partial(self._make_page_layout, page) | ||
module=page.id, | ||
name=page.title, | ||
title=f"{self.title}: {page.title}" if self.title else page.title, |
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.
This one line is the only functional change in the PR.
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.
I guess if people do want to overwrite it, they would overwrite the pre-build of the model here?
I was actually wondering how this works compared to the dash.app.title
. If you set the dash.app.title
, I noticed that it appears for a second and then it gets overwritten by anything defined in dash.register_page
.
This might be worth mentioning in the docs if people try to overwrite it via the dash.app.title
. This wouldn't actually work, because in the end it gets overwritten by the code here again. But I think this is also how it works in a pure Dash app?
app = Vizro(assets_folder="../assets").build(dashboard)
app.title = "My title"
app.run()
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.
This is indeed how it works in a pure Dash app also:
Dash(title="X")
corresponds to the propertydash.app.title
and sets the initial value of<title>X</title>
- but this only appears very briefly when you're using Dash pages, because it gets overwritten straight away by
dash.page_registry[page.id]["title"]
- after this, the original app
title=X
has no effect on anything
So for Vizro users where Dash pages is always used, the title
argument basically has no effect. @AnnMarieW please do correct me if I've missed something here.
We have possibly added to the confusion here because we have our own Dashboard.title
property, and it's not obvious to a user what effect that has on anything. I considered before whether we should do dash.app.title = dashboard.title
in Vizro.build()
but decided it was basically pointless because, like you say, it just gets overwritten straight away. I think it would be a very small improvement though, since that way you wouldn't see the "Dash" title at all, so let me add it in here.
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.
Change made in c00fe4e.
Signed-off-by: Antony Milne <49395058+antonymilne@users.noreply.github.com>
@AnnMarieW: I wanted to add you as a reviewer for this but for some reason can't do so - maybe some limitation of our github org settings I guess 🤔 Are you able to add yourself as reviewer? There's two reasons I wanted to add you anyway:
I think we should aim to get this merged ASAP before #185 so you can base your tests on the "new" style. |
@antonymilne I might have to be invited as a collaborator or a member before I can be added as a reviewer, but I think tagging me here works too :-) I like the new style of the tests and will wait until this is merged before writing the tests in my PR. Thanks for the help! I also like the new format for the title for the browser and the meta tags. Are you planning on updating the docs in a different PR? |
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.
I love the new title format. 🚀
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.
Looks great to me 👍
If we can just mention in the docs how the dash.app.title
and dashboard.title/page.title
overwriting works - I think that would help. I wasn't e.g. sure how it would actually work until I tested it out and saw that the dash.app.title
is always overwritten by the title defined in the dash.page_registry
. I guess that's the default behaviour coming from dash?
vizro-core/changelog.d/20231218_204302_antony.milne_improve_dashboard_title.md
Show resolved
Hide resolved
vizro-core/examples/default/app.py
Outdated
@@ -545,6 +545,7 @@ def create_home_page(): | |||
|
|||
|
|||
dashboard = vm.Dashboard( | |||
title="Vizro demo", |
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.
You probably just left this in for demo purposes, but I would remove it if this is close to being merged. It's not optimal in terms of design if there are controls/navigation on the page, as we still have this open discussion of where this might go.
Looking at this, I prefer the upper header container we discussed the other day even more 😄
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.
Actually I left it here so that we would hopefully apply the same change to vizro.mckinsey.com next time we update the demo, but let me remove it if we're not yet happy about the visual design.
The reason I think it would be nice to include sooner rather than later is because every time someone shares a link to vizro.mckinsey.com the social media preview will have a slightly strange label (like just "Homepage") - it would be nicer if it instead said "Vizro demo: Homepage" or similar, to make it clear what the link being shared actually is.
If we don't work out the page layout/visual design soon then possible alternatives might be:
- we remove the title from the dashboard layout altogether from
_make_page_layout
for now - we remove the title from the dashboard layout just by customising our demo app
So I'll revert the change here and leave it up to you to decide out what's the best solution here depending on how long the reworking of the page layout takes 🙂 It's not a huge thing but I don't think we should wait too long (say > 1 month) to get an improved shareable link to our demo app just because we're blocked on where to put the title on screen.
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.
we remove the title from the dashboard layout altogether from _make_page_layout for now
I think this would be a breaking change right? Or are we still fine saying that any visual changes are not considered breaking changes? 😄 I would be fine with this one to be honest - if people reach out, then we at least know people have been using a dashboard title and need it 😅
we remove the title from the dashboard layout just by customising our demo app
As a quick-fix, this one seems safer. The demo app would be a bit out of sync for a while with the example app here, but I think it's fine as we manage it.
What do you prefer? 1) I could embed in my current PR on layout arrangements and 2) I can create in another PR in the demo-app repository
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.
Reverted in 5cef34a.
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.
I wouldn't consider removing the title from the layout a breaking change since it's just something visual and no one's code will break in any way. Admittedly it's kind of a drastic one rather than just tweaking styling, but I'm completely fine with it and, like you say, if people ask where their title went then it's a good signal they want it there.
Which solution we go for depends to me on how close we are to resolving the question of where the title goes and how upsetting people find the current placement:
- if we're really not happy with how the dashboard title appears at the moment and it feels a long way off resolving let's go for option 1
- if we think it's ok currently but still don't want it on our demo app then let's go for 2
- if we think the current dashboard title is already completely fine then let's just leave it as it is and add a title to the example app
Personally I'm completely fine with the current visual appearance, which is why I just went for option 3 to begin with in this PR. But you have a better idea of how upsetting people with more design sensibilities find that and where future changes to layout might take us here, so completely up to you which option to choose 🙂
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.
That makes a lot of sense!
I think the position of the dashboard title will likely change given that it's taking too much horizontal space if there are no controls/navigations. Given that J. is also out, I'll go for 2) as I think it's the one he would feel less reluctant to implement 😄
I add it to my tickets and will update the demo accordingly after we've done release 0.1.8 👍
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.
Cool, thank you! Sounds good to me.
I didn't actually realise how weird it looks like when there's no controls/navigation until I just looked again now. You're right that doesn't look good at all, so I take back my statement above that option 3 was ok by me. Just in case you thought I had no design sensibilities at all 😀
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.
P.S. hopefully the demo update would be as simple as dash.layout["dashboard_title_outer"].hidden = True
or similar rather than needing any customisation of _make_page_layout
with a custom Dashboard
model.
module=page.id, name=page.title, path=path, order=order, layout=partial(self._make_page_layout, page) | ||
module=page.id, | ||
name=page.title, | ||
title=f"{self.title}: {page.title}" if self.title else page.title, |
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.
I guess if people do want to overwrite it, they would overwrite the pre-build of the model here?
I was actually wondering how this works compared to the dash.app.title
. If you set the dash.app.title
, I noticed that it appears for a second and then it gets overwritten by anything defined in dash.register_page
.
This might be worth mentioning in the docs if people try to overwrite it via the dash.app.title
. This wouldn't actually work, because in the end it gets overwritten by the code here again. But I think this is also how it works in a pure Dash app?
app = Vizro(assets_folder="../assets").build(dashboard)
app.title = "My title"
app.run()
I've just updated the docs in 7f981fb. When we write docs for your meta tag image and description pieces, I think it would belong in pages.md and then let's link to it from my text that mentions meta elements here in dashboard.md. I've changed a github setting that should mean that all users can now review PRs, but I still don't seem to be able to add you here. Maybe it will work in future PRs though, let's see. |
Signed-off-by: Antony Milne <49395058+antonymilne@users.noreply.github.com>
Description
Small precursor to #185, mentioned as part of #176.
When
Dashboard.title
is specified we now include it in the page title in the dash registry. This makes no difference to anything on the screen other than the<title>
tag and a meta tag. These are useful to get right because it means that the title of the page is much more meaningful in your browser window, when you try to bookmark a dashboard, and if you share a link of a Vizro dashboard that gets previewed e.g. on social media.Screenshot
Checklist
Types of changes
Notice
I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":