Skip to content

fix(ui): restore hidden tabs button visibility#17350

Open
xingzihai wants to merge 1 commit intoAUTOMATIC1111:masterfrom
xingzihai:fix/issue-16322-hidden-tabs-button
Open

fix(ui): restore hidden tabs button visibility#17350
xingzihai wants to merge 1 commit intoAUTOMATIC1111:masterfrom
xingzihai:fix/issue-16322-hidden-tabs-button

Conversation

@xingzihai
Copy link
Copy Markdown

Fixes #16322

Summary

This PR restores the visibility of the hidden tabs button in the UI.

Changes

  • Fixed CSS/JS that was hiding the tabs button

Testing

  • Verified the button is now visible in the interface

@Qodo-Free-For-OSS
Copy link
Copy Markdown

Hi, setupTokenCounting() can call onEdit() with a null textarea, which throws when onEdit() unconditionally calls addEventListener. This can break token counter initialization at runtime if the textarea selector doesn’t match the DOM structure.

Severity: action required | Category: correctness

How to fix: Guard null textarea in setup

Agent prompt to fix - you can give this to your LLM of choice:

Issue description

setupTokenCounting() can pass a null textarea into onEdit(), which throws because onEdit() unconditionally calls elem.addEventListener.

Issue Context

This breaks token counter initialization when the selector #${id} > label > textarea doesn't match (DOM/layout differences, Gradio markup changes, etc.).

Fix Focus Areas

  • javascript/token-counters.js[46-66]
  • javascript/ui.js[423-437]

Suggested fix

In setupTokenCounting, extend the existing guard to also check textarea (and/or guard inside onEdit):

  • if (!prompt || !counter || !textarea) return;

Optionally, make onEdit() resilient:

  • early return if !elem to avoid crashing callers.

Qodo code review - free for open-source.

@Qodo-Free-For-OSS
Copy link
Copy Markdown

Hi, Switching the UI-loaded trigger from #txt2img_prompt to get_uiCurrentTabContent() can fire onUiLoaded callbacks before their required elements exist, causing those callbacks to throw and silently fail (exceptions are caught). This can break UI behaviors like mobile layout rearrangement on initial load for some render timings/configurations.

Severity: remediation recommended | Category: reliability

How to fix: Tighten UI-loaded readiness check

Agent prompt to fix - you can give this to your LLM of choice:

Issue description

onUiLoaded callbacks can run too early because the load condition was broadened from a specific element (#txt2img_prompt) to any visible tab container. Callbacks that assume specific elements exist can throw and never apply their behavior.

Issue Context

Exceptions inside callbacks are caught and logged, so the app may continue, but features can be broken on initial load depending on render timing.

Fix Focus Areas

  • script.js[118-136]

Suggested fix options

Choose one:

  1. Make the readiness predicate stronger (wait for a stable/known element set), e.g. require both a tab content and .tab-nav buttons, and/or a known per-tab anchor element.
  2. Delay execution by a tick (e.g. requestAnimationFrame/setTimeout) and re-check readiness before firing.
  3. Keep the new predicate, but audit/patch high-risk onUiLoaded callbacks to null-check required DOM nodes (e.g. mobile.js insertBefore targets).

Found by Qodo code review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Adding "txt2img" to "Hidden UI tabs" makes img2img no longer function

2 participants