File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 111
111
112
112
.sidebar .sidebar-staleVersion {
113
113
display : inline;
114
- padding-left : 8 px ;
114
+ padding-left : 4 px ;
115
115
}
116
116
117
117
.sidebar .sidebar-staleVersion > a {
Original file line number Diff line number Diff line change @@ -30,7 +30,24 @@ function renderVersionsDropdown ({ nodes, latestVersion }) {
30
30
const versionsDropdownHtml = versionsDropdownTemplate ( { nodes, latestVersion } )
31
31
versionsContainer . innerHTML = versionsDropdownHtml
32
32
33
- qs ( VERSIONS_DROPDOWN_SELECTOR ) . addEventListener ( 'change' , handleVersionSelected )
33
+ const select = qs ( VERSIONS_DROPDOWN_SELECTOR )
34
+ select . addEventListener ( 'change' , handleVersionSelected )
35
+ adjustWidth ( select )
36
+ }
37
+
38
+ // Function to adjust the width of the select element
39
+ const adjustWidth = ( select ) => {
40
+ // Create a temporary element to measure the width
41
+ const temp = document . createElement ( 'span' )
42
+ temp . style . visibility = 'hidden'
43
+ temp . style . position = 'absolute'
44
+ temp . style . whiteSpace = 'nowrap'
45
+ temp . style . font = window . getComputedStyle ( select ) . font
46
+ temp . textContent = select . options [ select . selectedIndex ] . text
47
+
48
+ document . body . appendChild ( temp )
49
+ select . style . width = `${ temp . offsetWidth + 20 } px`
50
+ document . body . removeChild ( temp )
34
51
}
35
52
36
53
/**
You can’t perform that action at this time.
0 commit comments