Giter Club home page Giter Club logo

Comments (3)

dominikwilkowski avatar dominikwilkowski commented on September 27, 2024

Since maybe today this issue has gotten worse. Yesterday I was able to still click on items positioned on top of input fields as long as the input field wasn't already focused. Now it won't work at all.
I created a quick test case to re-produce my case with as little code as possible:

use floem::{
    event::{Event, EventListener},
    keyboard::{Key, NamedKey},
    peniko::Color,
    reactive::create_rw_signal,
    style::{CursorStyle, Display, Position},
    view::View,
    views::{container, h_stack, label, Decorators},
    widgets::text_input,
    EventPropagation,
};

fn app_view() -> impl View {
    let search_text = create_rw_signal(String::from(""));

    let view = h_stack((
        label(|| "Search:"),
        text_input(search_text).style(|s| s.width_full().position(Position::Relative).z_index(4)),
        container(label(|| "X"))
            .on_click(move |_| {
                println!("This is not clickable");
                EventPropagation::Stop
            })
            .style(move |s| {
                s.position(Position::Absolute)
                    .items_center()
                    .justify_center()
                    .height(30.0)
                    .width(30.0)
                    .display(Display::None)
                    .z_index(100)
                    .inset_top(0)
                    .inset_right(29)
                    .cursor(CursorStyle::Pointer)
                    .background(Color::rgb8(200, 20, 0))
                    .hover(|s| s.cursor(CursorStyle::Pointer))
                    .apply_if(!search_text.get().is_empty(), |s| s.display(Display::Flex))
            }),
    ))
    .style(|s| {
        s.flex()
            .items_center()
            .justify_center()
            .margin(10)
            .width_full()
            .height(30)
            .gap(3.0, 0.0)
    });

    let id = view.id();
    view.on_event_stop(EventListener::KeyUp, move |e| {
        if let Event::KeyUp(e) = e {
            if e.key.logical_key == Key::Named(NamedKey::F11) {
                id.inspect();
            }
        }
    })
}

fn main() {
    floem::launch(app_view);
}

This will render the below:
zindex
Note that I seem to be unable to execute the click handler. I tried with on_click and EventPropagation::Continue as well as on_click_stop.

from floem.

jrmoulton avatar jrmoulton commented on September 27, 2024

@Zoxc might have some feedback here. It seemed that there was a push to remove z-index entirely because z-index isn't supported in all renderers.

from floem.

Zoxc avatar Zoxc commented on September 27, 2024

It would require sorting to support all renderers and event handling. I don't think the complexity of that is justified.

from floem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.