Skip to content

Commit

Permalink
remove redundant code from action-bar-element (primer#3216)
Browse files Browse the repository at this point in the history
Co-authored-by: AdamShwert <adamshwert@github.com>
Co-authored-by: Alon Dahari <alondahari@github.com>
Co-authored-by: Arelia Jones <2359538+arelia@users.noreply.github.com>
Co-authored-by: Cam McHenry <camchenry@users.noreply.github.com>
Co-authored-by: Chris Maynard <ctmayn@github.com>
Co-authored-by: Cody Bodfield <cbodfield@github.com>
Co-authored-by: Dusty Greif <dustin.greif@gmail.com>
Co-authored-by: Jibran Garcia <jibrang@github.com>
Co-authored-by: Marie Lucca <40550942+francinelucca@users.noreply.github.com>
Co-authored-by: Cameron Dutro <camertron@gmail.com>
Co-authored-by: Jon Rohan <rohan@github.com>
  • Loading branch information
12 people authored Dec 3, 2024
1 parent 2c0e0b9 commit 23dd4fa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/weak-birds-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/view-components': patch
---

Remove redundant code for better performance.
8 changes: 0 additions & 8 deletions app/components/primer/alpha/action_bar_element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ class ActionBarElement extends HTMLElement {
#focusZoneAbortController: AbortController | null = null

connectedCallback() {
// Calculate the width of all the items before hiding anything
for (const item of this.items) {
const width = item.getBoundingClientRect().width
const marginLeft = parseInt(window.getComputedStyle(item)?.marginLeft, 10)
const marginRight = parseInt(window.getComputedStyle(item)?.marginRight, 10)
item.setAttribute('data-offset-width', `${width + marginLeft + marginRight}`)
}

resizeObserver.observe(this)
instersectionObserver.observe(this)

Expand Down

0 comments on commit 23dd4fa

Please # to comment.