Kepmon
Kepmon
Explore posts from servers
NNuxt
Created by Kepmon on 3/26/2024 in #❓・help
How to check on a client side that a user was redirected from middleware?
You're still probably a more experienced user than I am πŸ˜‰ I implemented this query param as you suggested previously. I had some issues afterwards with making it disappear after the page reload and so on, but ultimately I made it work and I'm almost happy with the solution πŸ˜… So thank you for the idea πŸ™ Regarding the useState composable... I didn't know about its existance so thank you again for informing me on that. Though, I was playing around with it for a short while and - in my scenario - it kept returning the default value, even though I'd changed it in middleware. So, I started reading more about it and I found this thread: https://github.com/nuxt/nuxt/issues/22668 that seems to explain why it wouldn't work for my use case. But, overall, it seems like a really handy thing and I already have another possible use case for it, so I'm happy you pointed it out to me πŸ˜…
7 replies
NNuxt
Created by Kepmon on 3/26/2024 in #❓・help
How to check on a client side that a user was redirected from middleware?
Hmm... so, I ended up with code like this:
if (to.path === '/dashboard' && userResponse == null) {
return navigateTo(
{
path: '/',
query: {
error: 'true'
}
},
{ redirectCode: 307 }
)
}
if (to.path === '/dashboard' && userResponse == null) {
return navigateTo(
{
path: '/',
query: {
error: 'true'
}
},
{ redirectCode: 307 }
)
}
and... works in Edge and Chrome, doesn't work in Firefox (I always say we should immediately stop supporting this stupid browser but no one would listen to me πŸ€·β€β™€οΈ). Unless I did something wrong (that's why the code). Though, this doesn't change my opinion on Firefox πŸ˜… Also, I checked the Network tab and it seems like Firefox thinks the error code for the /dashboard path is 301, whereas the Nuxt docs specifically say it's 302 (by default) and I specifically set 307, so.... I was thinking about your idea before but I refrained from implementing it because in general I don't like this error=true being in my address bar. And seriously, I thought that I'm just stupid and there was a simple solution to my issue. But, while talking to you, I'm starting to think that maybe this time this is not really the case... So... I guess, I'm going to stick to it and maybe I'll find another one in the future. Thank you for your assistance, it was really helpful πŸ™
7 replies
NNuxt
Created by Kepmon on 3/26/2024 in #❓・help
How to check on a client side that a user was redirected from middleware?
I didn't know about the redirectFrom param, so thank you for letting me know. Unfortunately, I'm afraid it wouldn't work that easily. I played around with it a bit and it keeps returning undefined. Then I found this thread: https://github.com/nuxt/nuxt/issues/15146 on Github issues that seems to explain why it wouldn't work.
7 replies
KPCKevin Powell - Community
Created by Kepmon on 9/30/2023 in #front-end
Astro - how to pass data from the server- to the client-side JavaScript
So... how do you do that? I mean, I'm pretty new to this whole SSR concept, so I feel a bit overwhelmed by that but I'm sure there has to be the way to do that. Like... people don't fetch data on a client-side when working with SSR-supporting technologies, do they? So... I actually hope, I'm just the stupid one here and I'm just doing something wrong (I'm quite a begginer to both Astro and SSR, so it's highly probable πŸ™ˆ) and there is a simple solution here that I just don't know about.
2 replies
KPCKevin Powell - Community
Created by Kepmon on 9/16/2023 in #ui-ux
NVDA doesn't see buttons inside a popup
Well, I actually thought this is some kind of an NVDA bug or that maybe browsers handle those v-if and v-show directives differently (my knowledge on how Vue works under the hood should be certainly improved). Therefore, I thought my code wouldn't be relevant. But, if you think, this may be due to CSS or JS, then here is my most up-to-date code: https://github.com/Kepmon/task-manager/tree/tas-281-improve-accessibility
4 replies
KPCKevin Powell - Community
Created by Kepmon on 9/16/2023 in #ui-ux
NVDA doesn't see buttons inside a popup
Since I'm very beginner to accessibility, I have no idea what's going on and how I can fix it. I spent around 2 hours googling for it and I found similar github issues as well as stackoverflow posts but I haven't found any solution. People writing those posts seem to use many different aria-attributes but I didn't test most of them because, to me, using as many aria-attributes as you're able to come up with doesn't necessarly improve the user experience, so I try as little of them as I possibly can. But, obviously, I wouldn't know any better, so I may be wrong on this one. Nevertheless, if it matters, I don't have any aria-attributes on this popup and only aria-label and aria-controls on this user-button. I could probably work around this by making this whole popup focusable and add an aria-label to it that would explain to a user that they should use Tab on this one, not the arrow keys, but I can see so many disadvantages of this approach... So, I thought, maybe there is someone here who faced a similar issue and know (or at least have an idea) what may be a source of my problem and could help me? Maybe should I in fact add an aria-attribute that I don't know about? But it works on Firefox and with this Silktide thing without additional aria-attributes... Nevertheless, I thought it wouldn't hurt to ask and in worst case scenario I can just go with the previously mentioned workaround.
4 replies
KPCKevin Powell - Community
Created by Kepmon on 9/7/2023 in #front-end
How to embed a rich-text editor on a website?
I understand. Thank you very much for your help and I hope I'll be able to implement that πŸ˜…
24 replies