Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve how the findbar's toggle button is referenced in the viewer code #18510

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

timvandermeij
Copy link
Contributor

The sidebar and secondary toolbar both have a reference to their toggle buttons in their own sections in getViewerConfiguration, so it makes sense for the findbar to do the same.

While we actually have a findbar-specific reference to the toggle button, I noticed that we don't use it consistently because the toolbar also has a reference to the exact same toggle button and we use both in the code. This is probably for historical reasons: the docstring in the toolbar file indicates that the viewFind element is an input to the component, but that option is never actually used in the code itself.

This commit fixes the issue by removing the toolbar-specific reference, since it's not actually used (anymore) in the toolbar code, so that we consistently use the findbar-specific reference everywhere.

The sidebar and secondary toolbar both have a reference to their toggle
buttons in their own sections in `getViewerConfiguration`, so it makes
sense for the findbar to do the same.

While we actually have a findbar-specific reference to the toggle
button, I noticed that we don't use it consistently because the toolbar
also has a reference to the exact same toggle button and we use both in
the code. This is probably for historical reasons: the docstring in the
toolbar file indicates that the `viewFind` element is an input to the
component, but that option is never actually used in the code itself.

This commit fixes the issue by removing the toolbar-specific reference,
since it's not actually used (anymore) in the toolbar code, so that we
consistently use the findbar-specific reference everywhere.
@timvandermeij
Copy link
Contributor Author

/botio-linux preview

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://54.241.84.105:8877/5839299d2eddb22/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/5839299d2eddb22/output.txt

Total script time: 1.04 mins

Published

@timvandermeij
Copy link
Contributor Author

timvandermeij commented Jul 29, 2024

I found this during a review of #18385 where I stumbled upon the following line not having been changed to viewFindButton:

viewFind: document.getElementById("viewFind"),

I found that it's quite easy to overlook such issues during review, and in this case it'd cause a subtle bug that we wouldn't immediately have found (since it's only visible in the supportsIntegratedFind = true case).

To investigate how feasible it is to extract smaller chunks out of #18385 I figured I should first get this pre-existing issue fixed to simplify the code and, if accepted, I can follow this up with PRs to extract actual bits and pieces from the PR (obviously crediting @calixteman as co-author of the work). Hopefully that'll help to make some progress on integrating the nice work from #18385 into the codebase in smaller steps, and get rid of some viewer code legacy along the way.

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me, nice find; thank you!

@timvandermeij timvandermeij merged commit 7199c96 into mozilla:master Jul 29, 2024
6 checks passed
@timvandermeij timvandermeij deleted the findbar-button branch July 29, 2024 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants