Code Monkey home page Code Monkey logo

Comments (6)

JanMiksovsky avatar JanMiksovsky commented on June 10, 2024 1

Okay. I've gone ahead with a change to report { canceled: "toggle" } in this case.

from elix.

stefnotch avatar stefnotch commented on June 10, 2024

This also happens with the .detail property of the "close" event. I tried out the whenClosed variant before checking the close event, because the documentation doesn't really tell you that this .detail property exists.

from elix.

JanMiksovsky avatar JanMiksovsky commented on June 10, 2024

Sorry for the slow response, will take a look as soon as I can.

from elix.

JanMiksovsky avatar JanMiksovsky commented on June 10, 2024

Thanks for your patience. I had time to dig into this today.

There appear to be two parts to this issue.

First problem: the relevant mixin, OpenCloseMixin, was resetting the closeResult to undefined whenever a component's open method was called. The idea is that, once a component is opened, its closeResult is not defined until the component is closed.

That's correct but insufficient. In this case, the FilterComboBox toggle button is calling the toggle method, which skirted the resetting of closeResult to undefined.

I've just checked in a fix for this first problem on #main. The fix resets closeResult to undefined whenever a component's opened state changes to true — regardless of how the component was opened. In particular, the closeResult will now be reset when the toggle method opens a combo box.

Second problem: what's an appropriate closeResult when the user closes the component by clicking the toggle?

If the user picked an item, the combo box returns that item via the closeResult. But there are a variety of other possible closeResult values for various UI actions that can close a popup, including: canceling with the Escape key, canceling with the F4 key (a standard popup close key on Windows), and canceling on window blur.

To the extent that closeResult communicates why a popup was closed, it feels like the same goal should apply to closing a popup by clicking the toggle again. For example, we could define a new close result: { canceled: "toggle" }.

(In retrospect, I wish that the closeResult for an item being selected had been something like { selected: <item> }, to indicate both why the combo box was closed and what was selected. But that would be a breaking change now, and I'd prefer to avoid that.)

Before defining a new closeResult for the toggle case, I wanted to see if you had thoughts about it.

from elix.

stefnotch avatar stefnotch commented on June 10, 2024

Glad to hear that the problem is now fixed!
I don't really have a strong opinion as to what the result is, as long as I can work with it.

from elix.

JanMiksovsky avatar JanMiksovsky commented on June 10, 2024

This has now been released as Elix 15.0.1.

from elix.

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.