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

Button inside nested with-bounds not firing #77

Open
Folcon opened this issue May 2, 2023 · 4 comments
Open

Button inside nested with-bounds not firing #77

Folcon opened this issue May 2, 2023 · 4 comments

Comments

@Folcon
Copy link
Contributor

Folcon commented May 2, 2023

I've managed to make a minimal repro case of a button on-click not firing:

(def ui
  (ui/with-bounds ::bounds-1
    (ui/dynamic ctx [{:keys [width height]} (::bounds-1 ctx)]
      (ui/column
        (ui/button
          #(println "ONE!!")
          (ui/label "ONE"))
        (ui/with-bounds ::bounds-2
          (ui/dynamic ctx [{:keys [width height]} (::bounds-2 ctx)]
            (let [width-part (quot width 10)]
              (ui/width width-part
                (ui/button
                  #(println "TWO!!")
                  (ui/label "TWO"))))))))))

Clicking on button Two, "TWO!!" is not printed.

Additionally is there a way to programatically detect text rendered or trigger buttons? I'm just wondering if I can use generative testing to create various nested UI and see if stuff breaks. It should help flush out more odd bugs like this.

@tonsky
Copy link
Contributor

tonsky commented May 3, 2023

Works for me

Screen.Recording.2023-05-03.at.17.54.49.mov

@Folcon
Copy link
Contributor Author

Folcon commented May 3, 2023

That's even more worrying:

Screen.Recording.2023-05-03.at.21.31.50.mov

You can't even see that I'm clicking...

(ns examples.broken-label
  (:require [io.github.humbleui.ui :as ui]))


(def ui
  (ui/with-bounds ::bounds-1
    (ui/dynamic ctx [{:keys [width height]} (::bounds-1 ctx)]
      (ui/column
        (ui/button
          #(println "ONE!!")
          (ui/label "ONE"))
        (ui/with-bounds ::bounds-2
          (ui/dynamic ctx [{:keys [width height]} (::bounds-2 ctx)]
            (let [width-part (quot width 10)]
              (ui/width width-part
                (ui/button
                  #(println "TWO!!")
                  (ui/label "TWO"))))))))))

I've tested this against b81c0115b2637a2aa3ad939ab91b1e139c919bdf and it's still an issue.

Any ideas?

@tonsky
Copy link
Contributor

tonsky commented May 4, 2023

No ideas. Is this Linux?

@Folcon
Copy link
Contributor Author

Folcon commented May 4, 2023

Macos

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

No branches or pull requests

2 participants