Skip to content

Commit 23dd4fa

Browse files
keithamusAdamShwertalondahariareliacamchenry
authored
remove redundant code from action-bar-element (#3216)
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]>
1 parent 2c0e0b9 commit 23dd4fa

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

.changeset/weak-birds-unite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/view-components': patch
3+
---
4+
5+
Remove redundant code for better performance.

app/components/primer/alpha/action_bar_element.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ class ActionBarElement extends HTMLElement {
3636
#focusZoneAbortController: AbortController | null = null
3737

3838
connectedCallback() {
39-
// Calculate the width of all the items before hiding anything
40-
for (const item of this.items) {
41-
const width = item.getBoundingClientRect().width
42-
const marginLeft = parseInt(window.getComputedStyle(item)?.marginLeft, 10)
43-
const marginRight = parseInt(window.getComputedStyle(item)?.marginRight, 10)
44-
item.setAttribute('data-offset-width', `${width + marginLeft + marginRight}`)
45-
}
46-
4739
resizeObserver.observe(this)
4840
instersectionObserver.observe(this)
4941

0 commit comments

Comments
 (0)