Skip to content

fix(notification-drawer): prevent list item layout shift when marking as read - #8134

Merged
mcoker merged 6 commits into
patternfly:mainfrom
tarunvashishth:fix/notification-drawer-no-layout-shift
Mar 2, 2026
Merged

mcoker merged 6 commits into
patternfly:mainfrom
tarunvashishth:fix/notification-drawer-no-layout-shift

Conversation

@tarunvashishth

@tarunvashishth tarunvashishth commented Feb 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #8091.

Prevents Notification Drawer layout shift when unread items are marked read by moving the list-item border from the element itself to a ::before pseudo-element. Visual styles remain the same; box size no longer changes.

Assisted-by: GitHub Copilot

Summary by CodeRabbit

  • Style
    • Notification drawer list-item borders now render via a layered overlay for more consistent visuals and preserved corner radii.
    • Removed direct borders from list items and adjusted read-state positioning to align with the overlay approach.
    • Added an adjustable focus outline offset to improve keyboard focus visuals.
    • Preserved existing state-specific border colors (info, warning, danger, success, custom, read).

@coderabbitai

coderabbitai Bot commented Feb 13, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 88b5b36 and 1d67438.

📒 Files selected for processing (1)
  • src/patternfly/components/NotificationDrawer/notification-drawer.scss

Walkthrough

Moved list-item border rendering to a ::before overlay that inherits border-radius and uses a new outline-offset variable (--notification-drawer__list-item--OutlineOffset); removed position: relative from the pf-m-read modifier to avoid layout shift.

Changes

Cohort / File(s) Summary
Notification Drawer CSS
src/patternfly/components/NotificationDrawer/notification-drawer.scss
Added --notification-drawer__list-item--OutlineOffset and applied outline-offset; replaced .notification-drawer__list-item border with a ::before overlay (absolute, inset:0, non-interactive) that renders border and preserves border-radius; removed position: relative from .pf-m-read; retained state-specific border-color logic delegated to the overlay.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • mcoker
  • kmcfaul
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title follows conventional commit format with 'fix' prefix and clearly describes the main change: preventing layout shift in notification drawer.
Linked Issues check ✅ Passed The code changes fully address issue #8091 by moving the border from the list-item element to a ::before pseudo-element, preventing layout shifts when items toggle read state.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the layout shift issue; the modifications to border handling, outline-offset variable, and ::before overlay are in scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@patternfly-build

patternfly-build commented Feb 13, 2026 •

Copy link
Copy Markdown
Collaborator

@mcoker mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM except for one thing. The focus outline on notification drawer items is now covered by the border. Can you address that? One fix could be to use an outline offset of -4px.

@coderabbitai
coderabbitai Bot requested review from kmcfaul and mcoker February 17, 2026 19:13

@mcoker mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just one update please, otherwise LGTM!

}

&:focus-visible {
outline-offset: var(--#{$notification-drawer}__list-item--focus--OutlineOffset);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you apply this style to the .#{$notification-drawer}__list-item element directly - not just on .pf-m-hoverable&:focus-visible? Since items have a border, seems fair that when any receive focus, the outline should be offset. FWIW we also do not currently use outline for any purposes other than focus outlines.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I’ve applied the style to .#{$notification-drawer}__list-item.

@coderabbitai
coderabbitai Bot requested a review from mcoker February 24, 2026 07:35
Comment on lines +186 to +188
&:focus-visible {
outline-offset: var(--#{$notification-drawer}__list-item--focus--OutlineOffset);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, what I meant was to move outline-offset to the main block of declarations for .#{$notification-drawer}__list-item - no need to just scope it to &:focus-visible

https://github.com/tarunvashishth/patternfly/blob/3ecfd7440d7e31b040fa2e36d7f3f08518cd3351/src/patternfly/components/NotificationDrawer/notification-drawer.scss#L166-L175

@coderabbitai
coderabbitai Bot requested a review from mcoker February 25, 2026 11:31

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/patternfly/components/NotificationDrawer/notification-drawer.scss`:
- Line 40: Rename the CSS custom property to match the existing OutlineOffset
convention: change --#{$notification-drawer}__list-item--focus--OutlineOffset to
--#{$notification-drawer}__list-item--OutlineOffset and update any usages to
that name so it aligns with the group-toggle variable (--OutlineOffset) and
removes the redundant --focus-- infix for consistency.

ℹ️ Review info

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ecfd74 and 88b5b36.

📒 Files selected for processing (1)
  • src/patternfly/components/NotificationDrawer/notification-drawer.scss

Comment thread src/patternfly/components/NotificationDrawer/notification-drawer.scss Outdated

@mcoker mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Coderabbit has a good point - no need for --focus in the var name now that the style no longer applies specifically for the focus state.

Comment thread src/patternfly/components/NotificationDrawer/notification-drawer.scss Outdated
Comment thread src/patternfly/components/NotificationDrawer/notification-drawer.scss Outdated
@coderabbitai
coderabbitai Bot requested a review from mcoker February 27, 2026 06:40
@mcoker
mcoker merged commit 66c6d91 into patternfly:main Mar 2, 2026
5 checks passed
@patternfly-build

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 6.5.0-prerelease.46 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

Bug - Notification drawer item borders cause layout shift

3 participants