#[jacky]does anyone here play games on https://itch.io? I've been wanting to make something like bridgy for syncing game play info to one's site. It'll be easier via Itch versus Steam
reed, calebjasik, Abhas[m], batkin[m], nekr0z, gRegor, moose3333, doosboox8, rhiaro_, sknebel_, wagle_, deeden, sebbu, petermolnar, Kaja, Zegnat, capjamesg, hendursa1 and james joined the channel
#capjamesgIn short, I: create a button element, set the right attribute / text content, and apprend it to the document.
#capjamesgOn button click, the user is taken to a random interview on my site.
#capjamesgWe discussed this on Friday and wanted to make sure I was on the right lines.
#capjamesgThe alternative is removing the button completely, which I'm open to.
#capjamesgNow the button does not show up in Lynx, which is expected because it will only work with JS (otherwise, the button will not display on the user's page.
#capjamesg!tell Murray The <details> element does not play so nicely with Lynx. But then again, neither did the JS button.
gRegor joined the channel
#capjamesgThe <details> element is a lot better actually.
#capjamesgIt may not work in Lynx (:D) but it's good to know my quizzes can run with JS disabled.
[Murray] joined the channel
#[Murray]Oh interesting. I assume Lynx just falls back to _showing_ the hidden text? Does Lynx have any dynamic states (CSS animations, hover states etc.)? (I've never seen the point of Lynx, so never used it)
#Loqi[Murray]: capjamesg left you a message 1 hour, 27 minutes ago: The <details> element does not play so nicely with Lynx. But then again, neither did the JS button.
#[Murray]!tell capjamesg Looks good to me. You'll want to add the `type` attribute with a value of `button` to that i.e. `element.setAttribute("type", "button");` Otherwise, I imagine that the `#interview_button` element is just an empty `<div>` or something? If so, seems good to me π
#capjamesgYeah. #interview_button goes to a <span> tag.
#Loqicapjamesg: [Murray] left you a message 8 minutes ago: Looks good to me. You'll want to add the `type` attribute with a value of `button` to that i.e. `element.setAttribute("type", "button");` Otherwise, I imagine that the `#interview_button` element is just an empty `<div>` or something? If so, seems good to me π
#capjamesgDefinitely very useful and they even talk about buttons that they have as semantic <a> tags for starting a form (where, as I have learned, a <button> tag would not be appropriate since no form action is being taken).
#capjamesg!Murray should I be using role='button' or type='button'?
jeremycherfas joined the channel
#Zegnatcapjamesg: if it is a button element already, no need for a role="button" attribute
#ZegnatA button element, by default (if nothing set) has the type "submit". If your button is not submitting a form, it is better to set it to type="button". This means browsers still treat it as a button, but will know it does not need to find form actions to associate with it.
#ZegnatHope that makes sense :) In general people add buttons only to submit forms, so that makes sense as a default. For JavaScript created buttons that trigger a custom action, set type="button" manually.
#Zegnat(The only other available type apart from "submit" and "button" is "reset", for clearing form fields within the some form as the button element.)
#[Murray]π this, and sorry for the confusion, I got mixed up the other day π
#[Murray]and I can thoroughly recommend everything the GovUK team have done around accessibility and user experience; their blog posts are a gold mine of usual information and genuine user research
#[Murray]not sure I've seen that exact video though, so thanks for sharing π
#capjamesgYeah. gov.uk / the Government Digital Service is amazing in terms of accessibility / testing info.
#capjamesgZegnat: I'm thinking about changing the button to an <a> tag.
#[Murray]In terms of switching to an `<a>` over a `<button>` , I think Barnaby made some fair points the other day in favour of `<button>`
#capjamesgYeah. I agree. I haven't encoutnered this question yet in any of my web work so I wanted to explroe it from all angles.
#capjamesg(Side question: what's the right way to "mention" someone in IRC? I know @XYZ is right in Slack but not sure about IRC)
#[Murray]given the new script you're using, I was tempted to say that it could just generate an `<a>` now but honestly, I think this is a rare case where both have some purpose
#ZegnatI think you can easily make cases for both button and a elements. And I am not sure the distinction really matters here. I think my personal preference would actually be the a-element. Because it triggers a navigation event, and browsers can show me where an a-element takes me, I can opt to open it in a new tab, etc. Lots of browser functionality you are not getting from buttons.
#capjamesgYep. I agree. Is the type=button necessary then?
#ZegnatOh, yeah, they are specifically turning a link into a button there. I am not sure why you would want that? If you are going to such lengths, just use a button element
#ZegnatIn your case, I would switch to an a element only if you want it to be a link more than a button
#capjamesgSo this link / button takes you to a random page on the site.
#capjamesgWhat is more appropriate: link or button?
#LoqiIt looks like we don't have a page for "more appropriate: link or button" yet. Would you like to create it? (Or just say "more appropriate: link or button is ____", a sentence describing the term)
#capjamesgI don't think a button is as appropriate because there is no form action (i.e. submit).
#ZegnatI think that question can only be answered from the UX point of view. Do you want the user to feel like they have pressed a button to trigger an action, or do you want them to navigate to a different page like a link.
#ZegnatThere are probably pros and cons for both scenarios
#capjamesgGood question. I want the element to be styled like a button because a link doesn't seem visually appropriate.
#capjamesgThe behaviour of this link is different from all others in that it takes you to a random page on the site, rather than a specific one.
#capjamesgA button helps create a visual distinction.
#capjamesg(Sorry, a button style helps create a visual distinction.) But a button is associated more with a form semantically from what I've read.
#ZegnatSure, but the semantics do not really matter for a user. Not really. And you can always patch up semantics with things like the role attribute (like what Gov UK is doing in the example you linked)
#ZegnatSo what is the experience you want to create for the users. Because browsers will offer different options depending on whether you go with a button or a element.
#ZegnatI personally really prefer normal links for navigational actions. Specifically because my browser stays in control of the navigation between pages. So I would just offer a completely normal a element.
#ZegnatBut I am also not a fan of surprises, so I realise the random button is not really aimed at me in the first place. I would probably have done it more like this: https://gist.github.com/Zegnat/ec461133a38801fe10d8242090f0a61b (you can run that directly in the browser console on the interviews page)
#capjamesgYour code more than anything illustrates that there is a better approach to this problem and you have identified it :)
#capjamesgI think your code gives the user a bit more predictability and a visual cue as to what to expect.
#ZegnatI am not sure it is better. There is definitely something to be said for random buttons too!
#capjamesgFor the user, the goal is to give them a random interview. And I don't want to dig too much deeper into semantics :D
#ZegnatBut for navigation on blogs and similar text media, I always come back to a keep-it-simple approach of anchor tags and clear signaling to users what will happen when they interact with it
#capjamesgYeah. Ultimately, I want the blog to be as easy to navigate and understand as possible.
#capjamesgYour addition of the text "looking for a place to start?" was helpful because it gives the user context that is not present.
#capjamesgThe button sort of sticks out in that it's not part of the logical flow of the page (there is no section specifically for the button, no title, no obvious progression between the text above and the button). A statement like "looking for a place to start?" solves this.
#ZegnatJust a rough idea, it could probably do with some tweaking.
#ZegnatAnother interesting user experience might be to put a random article from the list at the top, with some sort of "randomly selected" label
#ZegnatBut yeah, just my take on things :D Randomly selected article link up top.
#ZegnatThe beauty of a personal website is that you can put any button on there that you like ;) Make it sparkle and jump all over the place if that is more your fancy
#capjamesgFor sure. I think adding a random article to the list itself might be a bit odd in terms of the flow of the page but having one with a designated message before hand ("looking for a place to start?" or "new to my interviews? check out ...") is interesting.
#capjamesgI hope you are finding this as interesting as me Zegnat :D
#ZegnatI am half asleep, and this sort of discussion is exactly right for my current brain state, haha
#capjamesgAh. I've just eaten lunch and am taking it slow today. I was away on a day trip yesterday and I'm always very tired the day after.
#capjamesgI know that Google has their "i'm feeling lucky" button.
#Zegnatyeah, that is definitely another interesting one. But there is actually a secondary actoin taken on a form field (the search field) so a button makes sense. It also cannot really give you the browser UI of a link, because the link is not yet known.
#ZegnatIn your case, you can always know where you are sending the user. So you might as well tell them :)
capjamesg, barnaby, hendursaga and [Murray] joined the channel
#[Murray]Just to take it back to the semantics question: the best rule of thumb (as Zegnat hinted at) is to think about the action being taken. If you're navigating to a new page, use a link (`<a>`). If you're triggering any other kind of action, use a button. Style doesn't really matter (plenty of links look like buttons, plenty of buttons look like links; CSS/style is a different concern to semantics or functionality).
#[Murray]Now you have an interesting grey area, because the action is to first run a JS script that picks a random page, *and then* navigate to that page. You're doing both things, which is why either option becomes valid.
#[Murray]However, if you were to switch your code logic around for a second, I'd say an `<a>` becomes more semantically accurate. Instead of running the randomiser `onclick`, you could randomise the page url when the element is created and added to the DOM. If done that way, the actual element on the page will only ever do one thing: navigate. So I'd prefer an `<a>`. If you leave the randomising until the user clicks on the element, then I'd
#[Murray]prefer `<button>`. Like I said, bit of a grey area π
#[Murray](of course, all moot if you remove it for a different UX π )
gRegor, limeordl, buu_, KartikPrabhu, [Rose] and jamietanna joined the channel; barnaby left the channel
#jamietannaBack to the token expiry chat yesterday barnaby, GWG, Zegnat and sknebel
#jamietannaI find 7 days is quite good for apps that don't support refresh tokens (as they're still not implemented widespread) but I'm planning on reducing the lifetime of tokens for clients that do get refresh tokens to be ~1 hour, to limit the risk of those tokens being leaked
#jamietannaFor the case where we want infinite access, I'd prefer to have a "personal access token" style token that i.e GitHub allows, as a user-driven thing that can issue a token, which can then be included in i.e. some config file
#jamietannaFor apps that can support refresh tokens, I'd prefer to go that route, as it's a bit safer
#jamietannarefresh tokens I've made last 30 days - if an app doesn't use it in that time they need me to re-consent to the access
#ZegnatI would have to do more reading on auth vs refresh tokens to be able to have a better opinion on length.
#ZegnatI wonder if 1 hour might be too short. I know of a handful of APIs with such shortlived tokens that people basically do not bother with them and always use the refresh token first for every request. At that point I am not sure it still gives any real security benefit?
#ZegnatChicken and egg. I do not think there is a huge problem with servers finding a common ground on how to handle refresh tokens (issueing etc) first
#GWGFor me, next IndieAuth project is expiring setting set on the auth screen
#GWGBut a reference client to test against would motivate me on refresh