Repository navigation
Try: Linting notes - #78880
Try: Linting notes#78880jasmussen wants to merge 2 commits into
Conversation
|
Size Change: +880 B (+0.01%) Total Size: 7.74 MB 📦 View Changed
|
|
Should we use |
|
I see where you're coming from, and it's an option. Conceptually it isn't a fit with the idea of notes being a singular surface for anything related to the document. If we think of a note truly as just an annotation, made by a human, a lint tool, an agent, or a suggestion, then each of those are threads that can be discussions as well. Imagine one user hiding a block, then adding a comment below explaining why they hid that block. |
38acb76 to
765617d
Compare
|
My current reservation is that there's still a lot of work to do on the original Notes feature, and it's not flexible. I would like to avoid introducing complexity if we can for the moment. |
|
Thanks so much for looking. I find that to be a solid reason to revert this one to draft. The principles embedded in this PR, even if not the code, still feels valid to come back to when we have time! |
765617d to
b8d7c54
Compare
|
Noting that I have rebased this branch. I'm keeping it draft state, and I'm still thinking of this as a glorified proof of concept or prototype. Whether the largely AI assisted code can grow into a proper branch and land, I've no opinion of, but I think it is useful still to shepherd this along so that we can test and validate the concept. I still think it works. The rebase entailed removing a lot of bespoke code from this branch, to rather rely on the larger unification work that has happened to notes overall. It's still 14 files changed, but it should be less code do glance through. With no urgency. |
|
Flaky tests detected in 18a22b0. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/32360531148 Should save the changes in
|
|
@jasmussen This is really helpful prototype. Question 1: Is there a way to toggle the floating linting notes?I appreciate that the hidden-block messages show by default rather than being tucked inside the Notes sidebar. Where I got stuck is turning them off again. I couldn't find a way to get back to a clean view of the page. Once it's known, the user may want to go back to seeing just the design to continue working. That makes sense for collaboration notes. Someone is waiting on those, and they shouldn't be easy to lose. But I think block status has a different lifecycle:
Question 2: Could linting notes work without the Notes feature turned on?Do you envision a possibility where these two things could be separated in some way even though they share the same space? Notes is people talking to each other. Block status is the editor telling you what's true about a block. I think right now, any site that doesn't enable Notes, would then lose the benefits of these linting notes. For example, in our multi-site network, Notes are disabled at this time. See another user who requested a filter for this as well, so it's likely there are other groups who do not enable Notes. From a multisite perspective, I can share more about why we decide to disable them if you're interested. I would just need to speak more with our team to gather more details from the DevOps and support perspective. One of the reasons is that they send email notifications, and our team didn't want to risk that going wrong for hundreds of users. |
|
Solid UX questions, nice.
There's an ongoing effort relating to Notes in general, for how to show them, which would include this. One of the efforts that @annezazu and I believe @Mamaduka have been working on is a toggle to choose the appearance: full, compact, or possibly entirely hidden (i.e. have to click the Notes toolbar button). There's also a mockup here, which adds a collapse button to the vertical separator between notes and canvas. However part of the concept of these linting notes is to make them extremely obvious first and foremost, and secondly treat them solely as "Notes", ones that the system has authored rather than a user. You make a good point, however:
Indeed these linting notes would not be dismissible as such, at least not without adjustments to the concept presented here, so this is a good note. That being said, an adjustment would be to simply allow you to turn off linting notes in the canvas, perhaps in the same "compact" menu as the one Anne and George have been looking towards. Mainly, the motivation for using Notes, aside embracing an existing interface, is that hidden block and probably responsive styles should likely be obvious, always, that's the consistent feedback we've heard across a variety of different issues: people are looking for interfaces that surface these blocks. Generally the instincts go towards adding more indicators to the List View, which we can, it's just already relatively heavy on UI. Another instinct is a new panel in the document inspector: "Lint"—or a better term, that simply lists out issues. It's not clear any of those are obious enough, however, but I still think we could do both, that they can coexist and complement each other. E.g. both a Lint panel and in-canvas notes; if you end up toggling off the in-canvas notes, you'll still have the panel. Mostly I'm also just encouraging of PRs that start with minimal solutions: e.g. if it's easier to start with a panel than with in-canvas Notes, let's start there. We might even find it sufficient, in which case this prototype will also have served its purpose. Is that fair? |
I like the direction of the toggle to choose the appearance; that solves the challenge nicely!
This framing was helpful framing for me: notes the system authors versus the user. Thank you!
Yes! Absolutely. I agree with you that there's room to both, and agree about PRs that start with minimal solutions. I'll continue to follow the Notes discussion! Thinking only of users, and not the nuances with different site setups, it sounds like the Notes solution might solve the need you're hearing from users the best, so that this information is always obvious in the editor rather than hidden from the user behind a tab or separate panel. I would still advocate for a way to enable Notes with the option to filter out author notes, so that groups like ours could benefit from the system notes too. But I can understand that it might not be feasible for the Notes feature itself. We could put our efforts towards helping shape a complimentary "Lint" tab for groups like ours. I know there must be a better term, but I can't think of one right now :) |
b8d7c54 to
18a22b0
Compare
|
Rebased. |
Previously, blocks with `metadata.blockVisibility === false` were unmounted when unselected. This makes their position unmeasurable, which the linting interface in the Notes tray needs in order to peg annotations to their block. Now those blocks stay mounted with a new `is-block-hidden-unselected` class. The CSS takes them out of normal flow (`position: absolute; visibility: hidden; pointer-events: none`) so adjacent visible blocks lay out exactly as if the hidden block weren't there — preserving WYSIWYG, including margin collapsing through the gap. `tabIndex: -1` on hidden+unselected blocks keeps keyboard writing flow skipping them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
All WordPress notes are messages, whether added by hand by selecting text and commenting, or added for you. So the same mechanism can carry lint-style findings — "this block is hidden" — alongside them. This adds the first such rule and surfaces its findings as first-class threads in the Notes tray, using trunk's notes plumbing rather than reworking it: - `useLintItems` derives findings from the block tree, one per rule match, tagged `kind: 'lint'`. Nothing is persisted: the tree is the source of truth. - Lint items feed into the same `threads` list that drives the floating board, so each card floats aligned to its block just like a note. - `LintThread` reuses the note thread's canvas chrome (floating card, block highlight, keyboard nav, "Back to block"). Findings are derived rather than backed by comments, so it is a read-only surface: selecting one focuses its block instead of expanding a discussion. - `calculateNotePositions` falls back to the first measurable thread as its anchor, so one unmeasurable block no longer collapses the board. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
18a22b0 to
dcdec4e
Compare
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +830 B (+0.01%) Total Size: 9.05 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Regression: updating a specific option will only change its value and will not corrupt others in
|

What?
Starts work for #76996. Note: this PR is heavily Claude-assisted, so will need a good technical review. Or: it can serve as just a proof of concept/test-bed for the feature.
The notes tray is the single surface for everything in the document that needs human attention: notes, suggestions (#73411), and now lint. Like a teacher's notes in the margin of an essay. Always one thread per block. A block can have a human note, a lint message, and (later) a suggestion. They all live in the same thread, as cards inside one shared UI.
GIF showing the feature:
Why?
In addition to providing a highly visual interface for lint (notices, warnings, errors), this PR directly addresses feedback around hidden images being hard to find.
How?
From Claude:
{ kind, id, blockClientId, …payload }.NoteThreaddispatches onkind. Adding a kind is onecase; future'suggestion'plugs in without touchingnotes.js.wp_commentsviametadata.noteId. Suggestions live inmetadata.suggestion. Lint items are derived from rules — the rule'smatchfunction is the marker. The unified part is the output shape, not how it was derived.packages/editor/src/components/document-annotations/with no sidebar-specific imports — moving hosts later is agit mv.position: absolute; visibility: hidden, preserving WYSIWYG including margin collapsing. Keyboard nav skips them; the lint card is the discovery affordance.Testing Instructions
Create a new post or page, or open an existing one, just have some hidden blocks. Observe with the block inspector closed, or if you open the Notes archive using the top toolbar button, that there are "Hidden block" lint notes for each hidden block.
Use of AI Tools
Co-authored with Claude Opus 4.7.