Most active commenters

    ←back to thread

    Just use a button

    (gomakethings.com)
    285 points moebrowne | 11 comments | | HN request time: 0.888s | source | bottom
    1. flemhans ◴[] No.45774727[source]
    Why is the <div> option proposed by anyone in the first place?
    replies(3): >>45774762 #>>45774882 #>>45775944 #
    2. wrs ◴[] No.45774762[source]
    Based on what I see in the world, I suspect one reason is that a <div> makes it easier to apply some bizarro appearance to the button, so it not only doesn’t act like a button, it doesn’t even look like a button.
    replies(1): >>45776016 #
    3. Joker_vD ◴[] No.45774882[source]
    Well, have you been on, I don't know, TV Tropes? They have those long lists, that are separated into "folders" on a single page. You can click on those "folders" to expand/collapse them, and it's implemented as a <div> with "onclick" property and <ul> inside it (well, used to IIRC; nowadays this <ul> is a child of a sibling <div>).
    replies(2): >>45775658 #>>45777722 #
    4. 1-more ◴[] No.45775658[source]
    what's annoying about that example is that all of those <div>s could be buttons with no other changes. The only content inside the button <div> is the title and folder icon, not the list of examples associated with that title. That's just fine for a button!

    The other thing I'd do is add `aria-controls=folder0` to the button that toggles visibility of the list with `id=folder0`

    replies(1): >>45776461 #
    5. cferdinandi ◴[] No.45775944[source]
    The most common reason I've seen is whining about having to override default button styles.
    replies(1): >>45776436 #
    6. mcny ◴[] No.45776016[source]
    This comes from either business or the UX people who want stuff to look pixel perfect to their stupid wireframe.

    Why does a website that sells to a pretty much captive audience who cares more about functionality than looks obsess so much about every single button looking pixel perfect to some arbitrary wireframe, I will never know.

    replies(1): >>45779913 #
    7. no_wizard ◴[] No.45776436[source]
    I too have encountered this reasoning.

    Then I write some basic CSS and show them they have nothing to fear.

    Yet, I still remain irritated beyond belief that its such a common thing. In 2025. Hell, in 2017!

    I don't know what to do about it, other than constantly remind people about things, but it gets tiring.

    Though, its a great interview question. Its a quick way to understand if someone knows the fundamentals or not.

    Kinda like how people got ".bind" wrong on functions for years.

    8. no_wizard ◴[] No.45776461{3}[source]
    I'll do you one better and argue they could `<details>` elements. This is a perfect use case for that.
    replies(1): >>45777052 #
    9. 1-more ◴[] No.45777052{4}[source]
    I use them EXTENSIVELY but some don't like them for being annoying to control en-masse with the "toggle all folders" button at the top. But yeah I 100% agree with you. I've snuck them into a webapp where I just needed that much local state rather than have the whole page's state care about the collapse/open state of that one thing.
    10. zahlman ◴[] No.45777722[source]
    > You can click on those "folders" to expand/collapse them, and it's implemented as a <div> with

    ... Isn't that what <details> and <summary> are for?

    11. yakshaving_jgt ◴[] No.45779913{3}[source]
    Things looking intentionally designed in great detail is also a function, despite programmer protests.