Skip to content

Commit

Permalink
remove redundant code from action-bar-element (#3216)
Browse files Browse the repository at this point in the history
Co-authored-by: AdamShwert <[email protected]>
Co-authored-by: Alon Dahari <[email protected]>
Co-authored-by: Arelia Jones <[email protected]>
Co-authored-by: Cam McHenry <[email protected]>
Co-authored-by: Chris Maynard <[email protected]>
Co-authored-by: Cody Bodfield <[email protected]>
Co-authored-by: Dusty Greif <[email protected]>
Co-authored-by: Jibran Garcia <[email protected]>
Co-authored-by: Marie Lucca <[email protected]>
Co-authored-by: Cameron Dutro <[email protected]>
Co-authored-by: Jon Rohan <[email protected]>
  • 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 sign in to comment.