Simplify the dropdownToolbarButton
-select width computation
#15552
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The way that we set the width of the
dropdownToolbarButton
-select is very old, and despite some improvements over the years this is still somewhat hacky. In particular, note how we're assigning the select-element a larger width than its containingdropdownToolbarButton
-element. This was done to prevent displaying two separate icons, i.e. the native and the PDF.js one, since it's the only way to handle this in older browsers (particularly Internet Explorer).Given the currently supported browsers, there's however a better solution available: use
appearance: none;
to disable native styling of the select-element. According to MDN, this is supported in all reasonably modern browsers. This way we're able to simplify both the CSS rules and the JS-code that's used to adjust thedropdownToolbarButton
width in a localization aware way.