josdejong / svelte-jsoneditor

A web-based tool to view, edit, format, repair, query, transform, and validate JSON
https://jsoneditoronline.org
Other
820 stars 108 forks source link

Search Box horizontal scrollbar is always visible #219

Closed B1anky closed 1 year ago

B1anky commented 1 year ago

image

This behavior is visible even from your online example: https://jsoneditoronline.org/

The Search Box children elements upon inspection seem to occupy more than the available fixed width of the parent Search Box element. This causes a horizontal scroll bar to always be visible. Is it possible to adjust the search box's .css to be more of an adjustment based on percentages of the page? It will always show, no matter the width of the parent document element. Maybe even allowing the search edit itself to possibly shrink to some minimum width as well would be more visually appealing, as a suggestion.

josdejong commented 1 year ago

Thanks for reporting. I have tried to reproduce on Firefox and Chrome, but so fare without luck. So, to figure this out further, some questions:

B1anky commented 1 year ago

What browser and OS are you using?

  • Google Chrome Version 104.0.5112.101 (Official Build) (64-bit) on 64-bit Ubuntu 20.04.4 LTS.

Does it happen in other browsers too?

  • It happens in Mozilla Firefox version 109.0 (64-bit) on 64-bit Ubuntu 20.04.4 LTS.
  • I noticed it does not happen on my Windows machine running a slightly different version of Google Chrome.

Does it happen when in incognito mode?

  • It does still happen on the Ubuntu machine when in incognito mode.

Does it happen for specific JSON documents or anyone?

  • It doesn't seem to matter if the JSON document is populated or not.
  • It affects at least 3 other people with a similar environment which is almost everyone who has tested it.

Other note(s):

josdejong commented 1 year ago

Thanks for debugging this issue further. I still can't reproduce your issue, but I see on a very small screen, the input field isn't shrinking.

Does adding width: 0; min-width: 50px; to the CSS of jse-search-input fix the issue for you?

B1anky commented 1 year ago

Yes, adding those two css properties makes it act properly in my browser configuration. Specifically the width: 0 is what fixes it in the default sizing case, but the min-width: 50px is nice to have when the window is shrunk enough that the jse-search-input would best have some minimum size.

josdejong commented 1 year ago

That's good news!

Yes indeed, the width: 0 is what does do the trick: https://stackoverflow.com/questions/42421361/input-button-elements-not-shrinking-in-a-flex-container

I'll create a fix for this.

B1anky commented 1 year ago

Thanks for the quick turn-around and dialogue!

josdejong commented 1 year ago

teamwork 👊

B1anky commented 1 year ago

Makes the dream work :fist_oncoming:

B1anky commented 1 year ago

Ahh I just realized that the .jse-replace-input css also needs this change. If you hit the arrow in the .jse-search-box to expand down the replace-input, it has the same issue. Adding the same fix to that stylesheet also works properly as a solution though if you want to add it as well.

josdejong commented 1 year ago

Yes true. In d3ffdef I changed the CSS for all input fields in the search box, this matches both the search and the replace inputs:

https://github.com/josdejong/svelte-jsoneditor/blob/main/src/lib/components/modes/treemode/menu/SearchBox.scss#L49-L61

josdejong commented 1 year ago

The fix is published now in svelte-jsoneditor@0.14.4, and also in the web application https://jsoneditoronline.org v6.12.3