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

[Issue] Rehosting tab buttons causes gradio events not to be fired #59

Open
1 task done
vladmandic opened this issue May 29, 2024 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@vladmandic
Copy link
Collaborator

Issue Description

this seems a conceptual problem with modernui as we're rehosting buttons instead of tabs control so tabs control looses its functionality.

for example, event should be triggered in modules/ui_sections.py:create_hires_input, line

tab_scale_to.select(fn=lambda: 0, inputs=[], outputs=[selected_scale_tab])

with standardui event triggers and server gets correct info which tab is selected.
with modernui event does not trigger so server never knows which resize method (by size or by scale) is selected.

with standardui, gradio assigns following event dynamically to all non-active tab items (which are html button elements) so it triggers on click.
image

with modernui, that event does not get assigned.

this is gradio template for gr.Tabs, you can see how on:click gets assigned dynamically

<div class="tabs {elem_classes.join(' ')}" class:hide={!visible} id={elem_id}>
	<div class="tab-nav scroll-hide">
		{#each tabs as t, i (t.id)}
			{#if t.id === $selected_tab}
				<button class="selected">
					{t.name}
				</button>
			{:else}
				<button
					on:click={() => {
						change_tab(t.id);
						dispatch("select", { value: t.name, index: i });
					}}
				>
					{t.name}
				</button>
			{/if}
		{/each}
	</div>
	<slot />
</div>

to properly solve this, we need to stop rehosting buttons from tabs and rehost entire tab control. not a small change.

Backend

Chrome (and derivatives)

Branch

Desktop

Version Platform Description

No response

Relevant log output

No response

Acknowledgements

  • I have read the above and searched for existing issues
@vladmandic vladmandic added the bug Something isn't working label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant