#[solved] <a name="" /> is invalid in *.astro components - On purpose or ist it a bug?

17 messages · Page 1 of 1 (latest)

honest gull
#

I was wondering if anyone can confirm that <a name="somename" /> is actually not allowed in *.astro components. And if so: Does anyone know if this is a mere (typing) bug or is there something else to it?

Error: Property 'name' does not exist on type 'AnchorHTMLAttributes'

versed fractal
#

I'm not sure if it's Astro specifically, but probably a dependency that handles HTML typings.

#

depending on what you're trying to do, data-name might be a suitable alternative?

trail bone
#

It is Astro specifically

#

I wrote those typing myself

honest gull
#

Hey @versed fractal ,

what I meant is: I cannot create an anchor element with a name attribute, which is standard HTML since at least HTML 3.2 (https://www.w3.org/TR/2018/SPSD-html32-20180315/#anchor)

It works totally fine if I add this to my *.d.ts file:

declare namespace astroHTML.JSX {
  interface AnchorHTMLAttributes {
    name?: string | undefined | null;
  }
}
trail bone
#

name kinda doesn't exist anymore, does it

#

On mdn it has a "deprecated" icon next to it

honest gull
#

Hey @trail bone ,

it does. It still serves a purpose.

#

Oh.. Let me check

trail bone
#

I honestly didn't know about this attribute

#

If it does have a purpose, we could add it for sure

versed fractal
#

it doesn't appear in the latest spec, although that's not to say browsers don't use it in some way 🤔

honest gull
#

Ohh I see.. My apologies. Good to know. My HTML knowledge seems a bit ancient

honest gull
#

Can I mark this support request as "solved" somehow?

versed fractal
#

you can change the title to include a prefix like (solved), or react with a ✅ or something similar on the original post, but there's no need too