Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use <span> on Event when no url is provided #6266

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brandonwestcott
Copy link

@brandonwestcott brandonwestcott commented Apr 15, 2021

As described in #5710, current rendering produced invalid DOM when event render contains an a element. While onClick handlers inside the event allow a valid DOM, it limits the ability to have the normal benefits of an anchor tag, including "Open Link in New Tab" and a11y compatibility.

This implements a conditional check to see if url is set on the EventDef, if present use a, else use span.

Now, one could argue a => span | a could be considered a breaking change. If so, an alternative could be to add an additional attribute onto the EventDef to control the wrapping element type.

Resolves #5710

@brandonwestcott brandonwestcott changed the title use <span> on Event when no is provided use <span> on Event when no url is provided Apr 15, 2021
@giovanniincammicia
Copy link

Any update on this? I believe this has been open for a while now (the original issue was opened more than a year ago).

@vrinceanuv
Copy link

Any updates on this?

@eloyesp
Copy link

eloyesp commented Mar 8, 2022

Just wanted to add that I think that it should be a div not a span by default, as the later will have have other nesting issues, as it will make it impossible to use block elements.

@brandonwestcott
Copy link
Author

Just wanted to add that I think that it should be a div not a span by default, as the later will have have other nesting issues, as it will make it impossible to use block elements.

@eloyespa to div is definitely a break change because div default render is block where as span and a are both inline. If you would need the element to behave like a block, just set it in css like you would on the current a

@brandonwestcott
Copy link
Author

Happy to rebase this if @arshaw gives a 👍 for the proposed change.

@ben467834
Copy link

I think this is still an issue. I don't think we're expecting block elements here so span is still the best inline candidate to be an anchor alternative.

@dc-devs
Copy link

dc-devs commented Feb 11, 2023

Bumping as this issue looks like it hasn't been commented on in a while. I would also love to see this update.

Couple ideas for other possible solutions:

  1. Would the solution of adding a custom eventTagType for an event be possible? This would introduce a non breaking change, and allow us to customize the element..
<FullCalendar
 ...
eventTagType="span"
/>
  1. Would we be able to add our own eventComponent, and not just have access to updating the eventContent?
<FullCalendar
 ...
eventComponent={<CustomEventComponent />}
/>

Edit: Reading more thoroughly through @brandonwestcott 's original comment its seems my first solution could easily be handled by adding a custom prop to the EventDef. Would love to see some way to customize this element type.

If so, an alternative could be to add an additional attribute onto the EventDef to control the wrapping element type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Interactive content inside eventContent hook produces invalid DOM
7 participants