https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • b

    blue-ghost-19146

    09/20/2022, 4:00 PM
    Yes, I’ve created a tab structure with htmx and it works nicely! Definitely a good use case for it, I’d say
  • h

    hundreds-camera-24900

    09/20/2022, 4:09 PM
    I thought about it a little - what seemed the simplest is a base template that has a few hx-trigger="load" statements, and then a set of partials that load specific parts of the page - if you go directly, you get the base template which lazy loads in the sections, and if you load through htmx you get just the partial
  • a

    ancient-shoe-86801

    09/20/2022, 4:13 PM
    well, I want my app to have a favicon, so that's not an option. I have that as
    Copy code
    <link rel="icon" href="/static/favicon.ico" sizes="any">
    on the home page, which then retrieves others fragments using htmx based on user interaction, and for each fragment there is an addition favicon request.
  • t

    tall-river-23601

    09/20/2022, 4:14 PM
    @hundreds-camera-24900 Are you refering to fragments, when saying "partials"? My point is to have a generic pattern to "upgrade" large, existing pages with lazy-loading.
  • a

    ancient-shoe-86801

    09/20/2022, 4:14 PM
    interestingly, I notice that the extra requests keep going to /static/favicon.ico, not to the default /favicon.ico
  • h

    hundreds-camera-24900

    09/20/2022, 4:17 PM
    yeah
  • a

    ancient-shoe-86801

    09/20/2022, 5:08 PM
    uh, the favicon thing seems to happen only with firefox
  • l

    limited-ram-62101

    09/20/2022, 9:56 PM
    @Sergi I could be wrong but I am pretty sure that if you just serve the one favicon from the expected location, you won't even need the link tag in your markup, as browsers will find it. Also the multiple requests for things sometimes happen to me when I have F12 dev tools open and caching disabled.
  • a

    ancient-shoe-86801

    09/20/2022, 10:05 PM
    I am dumb, it's not Firefox, is with Brave. Caching is not disabled. That makes it even weirder, as it's also Chromium based...
  • a

    ancient-shoe-86801

    09/20/2022, 10:10 PM
    not happening with Firefox either... I wonder if it's a plugin I have... nvm folks, at this point seems to be a "user environment" issue
  • a

    aloof-crayon-56651

    09/21/2022, 3:28 AM
    Hey, I've got a htmx/_hyperscript combo question. I have a form with some checkbox inputs. I want to filter some stuff on my backend depending on which checkboxes are checked. With simple checkboxes, it works (well, not really, but that's a backend issue). However, I want to style my checkboxes by replacing their appearance with img's. I try to check the checkboxes using hyperscript, but it doesn't work correctly.
  • a

    aloof-crayon-56651

    09/21/2022, 3:29 AM
    If I put the
    hx-post
    attribute on the
    <input>
    , no request is sent.
  • a

    aloof-crayon-56651

    09/21/2022, 3:32 AM
    If I put it on the
    img
    that I click, then the request is sent, but before the input is checked. If I click the
    img
    again (to uncheck the input), then the request is sent with the checked attribute set.
  • g

    gorgeous-airport-54386

    09/21/2022, 3:33 AM
    I would try to figure out a way to add the images with CSS
  • g

    gorgeous-airport-54386

    09/21/2022, 3:33 AM
    If you hide the inputs it's going to be very confusing to someone tabbing through the form, which is a common thing to do
  • a

    aloof-crayon-56651

    09/21/2022, 3:54 AM
    The styled version looks like this:
  • a

    aloof-crayon-56651

    09/21/2022, 3:57 AM
    Is hiding the checkbox the problem?
  • g

    gorgeous-airport-54386

    09/21/2022, 3:58 AM
    What does the .hidden class look like
  • a

    aloof-crayon-56651

    09/21/2022, 3:58 AM
    display: hidden;
  • g

    gorgeous-airport-54386

    09/21/2022, 3:58 AM
    What is the code
  • g

    gorgeous-airport-54386

    09/21/2022, 3:58 AM
    That will remove the checkbox from tab order and accessibility tree
  • g

    gorgeous-airport-54386

    09/21/2022, 3:58 AM
    I would use
    appearance: none
  • g

    gorgeous-airport-54386

    09/21/2022, 3:59 AM
    and don't forget to add focus styles
  • a

    aloof-crayon-56651

    09/21/2022, 4:00 AM
    This is what it looks like with that change.
  • g

    gorgeous-airport-54386

    09/21/2022, 4:00 AM
    which browser?
  • a

    aloof-crayon-56651

    09/21/2022, 4:00 AM
    Brave (Chrome based)
  • g

    gorgeous-airport-54386

    09/21/2022, 4:00 AM
    sigh
  • g

    gorgeous-airport-54386

    09/21/2022, 4:00 AM
    it worked in firefox
  • g

    gorgeous-airport-54386

    09/21/2022, 4:01 AM
    anyway the hyperscript in your example seems redundant
  • g

    gorgeous-airport-54386

    09/21/2022, 4:01 AM
    clicking the label will already click the input
1...830831832...1146Latest