Skip to content

<A> should support "mailto:" hrefs #266

Closed

Description

@DaniGuardiola

I'm using this component to render links in some MDX content, which is convenient since it works out of the box for any kind of links, internal or external. However, it doesn't seem to handle mailto href values appropriately, forcing me to create a custom wrapper. I think it should probably be supported out of the box, along with "tel" and other similar patterns.

Activity

  1. changed the title [-]<A> doesn't support mailto: hrefs[/-] [+]<A> doesn't support "mailto:" hrefs[/+] on Apr 18, 2023
  2. russelgal commented on Apr 18, 2023

    @russelgal

    but <a/> supports ))

  3. DaniGuardiola commented on Apr 18, 2023

    @DaniGuardiola
    Author

    @russelgal I'm not sure what you mean. I use Solid Start's <A> because I want to be able to link to other pages in my blog posts, and for those links to work client-side without causing a full refresh.

  4. russelgal commented on Apr 18, 2023

    @russelgal

    <A/> for internal links
    <a/> for href="tel:|mailto:" etc

  5. DaniGuardiola commented on Apr 19, 2023

    @DaniGuardiola
    Author

    @russelgal I understand the current behavior, and that's what I'm doing as my workaround. This is a proposal to improve <A /> by adding support for that type of href value.

    Btw, I just realized there's a similar problem with anchor links (e.g. #section-name) that's forced me to build a similar workaround for them. So I'd add that to the proposal.

  6. boehs commented on Apr 21, 2023

    @boehs

    Again, <A/> is specifically for links that trigger CSR. I don't see what's wrong with that?

  7. DaniGuardiola commented on Apr 22, 2023

    @DaniGuardiola
    Author

    @boehs it's not wrong. I'm just proposing that other types of href values are supported, just like external values already are.

    I'm not sure if it's accidental or intentional, but right now you can use <A /> for URLs that are not internal (such as a twitter profile) and it works just fine. In fact, that makes a few situations much easier to implement, like rendering some links in a header from data that contains a mix of internal and external URLs. That's in fact what I do in my new blog: dio.la (code: https://github.com/DaniGuardiola/dio.la/blob/d7e018f3e84eff06be896bba23f9e839f840aaca/src/root.tsx#L35-L59)

    This property of <A /> means that I don't need to be manually checking every URL to determine if it's internal or external to conditionally render <A /> or <a />, which is a great feature IMO.

    As I explained, this same pattern could extend to other href value types like mailto: to gain the same benefits.

    It's just a proposal, so I 100% understand if there are arguments against it, but please do try to understand what I'm asking for here :P

  8. boehs commented on Apr 22, 2023

    @boehs

    Thanks, this is helpful

  9. ryansolid commented on Aug 8, 2023

    @ryansolid
    Member

    Adding more bails out on seems unnecessary. Like if you are using mailto: you probably know. But I will move this to discussions. Because of developments around partial hydration patterns I am still very much thinking about the impact of <A> vs <a>.

  10. changed the title [-]<A> doesn't support "mailto:" hrefs[/-] [+]<A> should support "mailto:" hrefs[/+] on Aug 8, 2023
  11. locked and limited conversation to collaborators on Aug 8, 2023
  12. converted this issue into a discussion #284 on Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions