-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add devToolbar.placement configuration option
#15015
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: bd8c445 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
devToolbar.placement configuration option
bc17e05 to
8e300bb
Compare
8e300bb to
88b0cb2
Compare
88b0cb2 to
c6821fa
Compare
|
@withastro Dev toolbar placement is tied to a site’s layout rather than an individual user preference, so defining it in config makes the default explicit and consistent across environments (e.g. dev machines, browser instances), while still preserving local overrides. Assuming the case is sound, is this the right approach for introducing the config option? Are there any other boxes I should be ticking? |
|
Hello! Apologies for the delay, with the upcoming Astro 6 and the holidays, some things fell through the cracks. I'll be reviewing this shortly! |
Princesseuh
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.
Good with me, awesome work!
sarah11918
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 for providing this new feature! Left a note on the kind of changeset message we'd typically like to have with an example you can use as a model. And the docs look good! Just tiny updates!
a78725a to
923d8c4
Compare
|
@Princesseuh @sarah11918 Thank you - Rebased! Let me know if this works! |
cef52b4 to
6b3689b
Compare
sarah11918
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.
Approving for docs! Thanks for making the dev toolbar even more usable! 🥳
Add exported type for toolbar placement options and extend DevToolbarMetadata to include optional placement property.
Add optional `placement` property to devToolbar config schema and interface with JSDoc documentation.
Pass the devToolbar.placement config value to the client via __astro_dev_toolbar__ metadata injection.
Implement the settings priority chain: 1. defaultSettings (hardcoded 'bottom-center') 2. Config placement (from astro.config.mjs) 3. localStorage (user's persisted choice) This allows project-level default placement while still respecting user's UI-driven placement preferences.
Test that: - Valid placement values are accepted - Placement is optional (can be omitted) - Invalid placement values are rejected
Minor version bump per Astro convention for new config options.
Include @Version added and tweak comment copy Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
|
@sarah11918 Thank you! |
6b3689b to
2cb299e
Compare
- Add js syntax highlighting to code block - Fix spacing in comment - Fix "overriden" → "overridden" typo
2cb299e to
bd8c445
Compare
RFC / Context: Dev Toolbar: allow configuring default position roadmap#1277
DX / Quality of life tweak for dev toolbar placement.
Changes
Adds optional
devToolbar.placementconfiguration option.New config property:
devToolbar.placementaccepts'bottom-left','bottom-center', or'bottom-right'Priority:
defaultSettings→config→localStorage(user's UI choice still wins)Use case: Sites with bottom-center UI elements (chat widgets, cookie banners) can set a project-wide default that persists across team members and localStorage clears
Example:
Before this PR, it would require manually setting the
placementevery timelocalStorageis cleared. Doesn't persist as a project default.Exampe usage,
astro.config.mjs:Files changed
types/public/toolbar.tsDevToolbarPlacementtypetypes/public/config.tsplacementto interface with JSDoccore/config/schemas/base.tsvite-plugin-astro-server/pipeline.tsruntime/client/dev-toolbar/settings.tstest/units/config/config-validate.test.jsTesting
Testing only
test/units/config/config-validate.test.js:pnpm:
npm:
Docs
@withastro/maintainers-docs for feedback, Documentation needed for:
devToolbar.placementoption'bottom-center'