#capjamesg[d]What is the best way to add HTML into a contenteditable field?
#LoqiIt looks like we don't have a page for "best way to add HTML into a contenteditable field" yet. Would you like to create it? (Or just say "best way to add HTML into a contenteditable field is ____", a sentence describing the term)
#capjamesg[d]Oh Loqi, I thought you would know that 😂 just kidding.
#capjamesg[d]The use is for automatic highlighting when @ mentions are used in a text field.
#capjamesg[d]The field is contenteditable vs. textbox for this reason.
#capjamesg[d]I built something that works but for some reason the cursor gets sent back to the start of the field.
#capjamesg[d]So "@tantek Great blog post about websub!" would become "Great blog post about websub! @tantek" if I just kept typing.
#[manton][aaronpk] Another side effect of including HTML on events.indieweb.org that could be improved… Kimberly’s RSVP has an h-card with “display: none” to hide on her blog, but the image shows up in the RSVP.
#[manton]Wonder if maybe all images should just be stripped out. I’m sure it won’t be perfect but seems like usually they don’t need to be shown.
jacky and nertzy joined the channel
#aaronpkhmm, I think this is not what I would expect the markup to look like tho...
#jackyI could see it being used to tag other people in it
#jackybut for an *-author, I can see that being weird
#[manton]Yeah, usually the h-card would be somewhere else on the page. But I don’t think it’s necessarily wrong, either. I’ve used this kind of markup myself.
#aaronpkYeah I mean specifically the author h-card
#aaronpkI do think it's "wrong" as demonstrated by the fact that you used display: none
#aaronpkof your goal is to hide it from humans reading it, you should also hide it from parsers, which you do by not putting it in the e-content
#[manton]Hmm. In this case, there is no way to put it somewhere else except e-content. You could say that’s a limitation in Micro.blog, but I can imagine other systems working like that too.
#aaronpkwhy is there an e-content class if there isn't already an author?
#[manton]Looks like this theme doesn’t have any author markup.
#[manton]So I’m sure that’s why they put the h-card in the e-content… Basically a choice between modifying the theme or just pasting in some extra HTML in the post.
#aaronpkthere's no author markup on the home page either?
#Loqi[Manton Reece] I’ll be attending IndieWebCamp West later this month. It’s online-only, centered in the west coast timezone, but anyone around the world is welcome. Need to think about IndieWeb-related goals for Micro.blog that week.
#[manton]I totally get that this is a little hacky, but I think it should be allowed, personally.
#aaronpkIf there was an h-card on the home page, then the post could have a link like <a href="/" class="u-author">Kimberly</a> and the receiver can go fetch the full h-card from there and you can also show that link because it makes sense
#aaronpkthinking about this generically (since one-off examples often make sense but you forget the implications of something like that in the larger context), this seems very similar to the issue of putting photos inside the content with u-photo as well
#sknebelit's always a mess for consumers to clean up
#aaronpkits almost like what you want the parser/consumer to do is: if an HTML element inside an e-* contains other microformats properties that result in properties being added next to the e-* property, then you want to remove those elements from the HTML of the e-*
#aaronpkbut I'm also not sure if that would break a bunch of other things too
#[manton]The nice thing about including photos inside e-content is that the HTML can be used in a lot of different contexts (like feeds) without requiring any special behavior to look right.
#sknebelit would break on your example with a link on the name
#sknebelor you could use the html you use for display instead of just the e-content in feeds
#sknebelyou can even *store* that if you want to access it statically
#[manton]Just speaking for myself, there is no difference between e-content and the HTML I use for display.
baracurda_ joined the channel
#aaronpkLol sknebel you're right, this is why test cases are useful :-D
#aaronpkNow I'm confused [manton], images *are* allowed in HTML e-content right now, which is causing the problem with the RSVP ;-)
#aaronpkGWG: just the same situation manton is in where people can add arbitrary html including microformats into the content box and the theme already has its own microformats outside of it that the user can't modify
#GWGaaronpk: I came up with a hacky solution for that...but the design of WordPress makes consistency problematic
#GWGI only insert e-content around the origin content..not anything added dynamically.
#[manton]Maybe let’s take a step back. Assuming the user can’t modify anything except what’s in e-content, is there a best practice for including h-card info?
#jackyI've always assumed it's been as a sibling to e-content/p-summary stuff
#aaronpkback to the specific problem, I'm actually confused why the event site is showing that at all because I thought my quick fix the other day was to show only the text content of comments
#[manton]For events, it seems ideal to allow HTML but strip out images and do other sanitization. That way you can have links but it doesn’t look too cluttered with other stuff.
#aaronpkremoving all images would break it for blog posts with inline images
#sknebelfiltering the image would still leave the text from the h-card
#aaronpkI suppose you could argue that specifically for showing comments on a post or event, you would just always remove images in the content. That'd also break reaction gif posts tho
#sknebel(re what's the workaround: a link to a fuller h-card on something that's part of the text or an empty link, that at least doesn't show up visibly)
#aaronpkAlso note that link doesn't *have* to be to the home page, it can be to any page with an h-card
#[manton]So, I looked into what Micro.blog is doing here… And it’s ignoring “display: none” too. But apparently I’m styling the h-card photo so it’s smaller/inline: https://micro.blog/kimberlyhirsh/12444267
#[manton]That’s it. I must’ve noticed this problem and that was my “fix”.
#aaronpkI think I wouldn't be opposed to adding that too
#sknebelthus showing people its ok to do, because it doesnt break where they see it :/
#GWG[manton]: You also special cased my svgs, didn't you?
#aaronpkBut it's not entirely wrong, just not ideal
#[manton]I think [aaronpk]’s point about blog post comments is good too… Those should allow at least some images, similar to RSVPs, but you don’t want the text taking over the page with all sorts of styling or big images.
#[manton]@GWG I do something similar for WordPress emoji PNG/SVG, maybe that’s what you’re thinking?
#[manton](Where WordPress uses images instead of real emoji.)
#[KevinMarks]the bridgy html feeds are fun like that as there's no constraint on image size so you get huge images
#[manton]Yeah, I have some CSS for WordPress looking for “img.emoji” and “img.wp-smiley” and probably others. And when looking for specific HTML, I actually have a list of filenames like “1f3b5.png” for books.
#[manton]I went to test this in WordPress and it looks like they’re no longer replacing emoji with images by default! Nice.
#[manton]Definitely an accessibility problem so I was wondering if WordPress already put something suitable in “alt”. But now don’t have a good reference for what WordPress used to do.
#aaronpktwitter of course doesn't have any useful markup around their img emojis
#aaronpkhm, should this h-card example use aria-hidden="true"?
sarahd[d], daiyi[d], Asaf_Agranat[d], Jeremiah[d], rattroupe[d], aspenmayer[d], sayanarijit[d], Seb[d], Murray[d], shaunix[d] and Zegnat[d] joined the channel
#sknebelaria-hidden="true" should not be added when:
#sknebel The element or the element's ancestor is hidden with display: none
#sknebel The element or the element's ancestor is hidden with visibility: hidden
corenominal[d], aaronpk[d], hans63us[d], capjamesg[d], Osvik[d], hoenir, mossymaker[d], Myst[d], Ramon[d], balupton[d], P1000[d], wackycity[d], marksuth[d], dovedozen[d], Christian_Olivie, MarkJR84[d] and barnaby joined the channel
#aaronpkyeah it seems like hiding stuff in the e-content with display: none and then being surprised when it shows up in something that consumes the e-content is the real problem here
#aaronpkso i think i have 2 options for the event site. either I add similar css as micro.blog to make that image appear small and inline, or i allow the "display: none" css
ben_thatmustbeme and cygnoir[d] joined the channel
#GWGYou can turn off the JavaScript that replaces emojis with images I believe...
jacky joined the channel
#[manton][aaronpk] The quick fix is definitely the CSS… I think the problem I ran into with “display: none” is being smart about allowing it _without_ also allowing everything else that can go in a “style” attribute.
#aaronpkyeah i'm reading the htmlpurifier docs now to figure that out
#[manton]Cool. If that already supports it, that would be great. I don’t think the library I use (“sanitize” Ruby gem) didn’t, although I should check again.
#aaronpki guess the other option is i could just remove images from responses for the event site
#aaronpkthat would turn it into "I Kimberly Hirsh am RSVPing yes to Micro Camp 2022"
#[manton]Oh, this gem actually does support it. I just don’t have “display” listed on my allowed CSS properties. Hmm.
#[manton]Removing images seems like a reasonable solution to me for RSVPs. I can’t imagine that images are used very often in RSVPs.
#aaronpkthis isn't just for RSVPs though, this is for all comments on an event
nertzy joined the channel
#aaronpktho you do bring up another point which is if a response *is* an rsvp, then i could remove images
#[manton]Yeah, good point, maybe RSVPs have a different behavior. I forgot that events support non-RSVP comments.
#aaronpkhm there does seem to be a config to allow some css attributes
#aaronpki'm a bit more nervous about that, i think i might just not show images at all
#aaronpkok yeah, going to go with that for now since it's less of a drastic change. photo responses are also still supported too since those are treated entirely differently and will pull photos into a nice photo grid
#aaronpkoh, and that also more or less reverts it back to the previous state it was in a few days ago when only the plaintext content was used
#aaronpkthat was a lot of faff for what ended up being just adding 8 characters to the code
#capjamesg[d]I have been beefing up my Microsub post interface. I can now auto link to person tags and get a list of recent hashtags I have used that match what I am trumping.
#capjamesg[d]There is now a visual indicator for uploaded images (no more HTML in the client input field for images!). And I can use emojis with the : syntax.
#capjamesg[d]writing all of this in raw JS has been quite tedious and done over quite a long time.
#capjamesg[d]The person tags come from the proposed micropub contact extension my endpoint supports. And the hashtags come from my micropub endpoint too.
#[tantek]I still think photos make sense inside e-content because they're literally part (if not the primary aspect) of the visible content being presented
#[tantek]we should expect that there will be lots more use-cases for additional properties or nested microformats inside e-content
#aaronpkthere's no concern with photos inside e-content if they are part of the content, it's only a problem when they are *also* marked up with u-photo
#aaronpkit's effectively duplicating the photo since it then appears both in the content and outside the content
#aaronpkhere's another way of thinking about it... the point of adding microformats markup is to *help* consumers of that data do something with it. if adding markup is actively making it more difficult for the consumer then don't add the markup. in other words, having a photo inside the content is fine with no other markup of the photo. but if you want to help consumers do something smart with that photo (show
#aaronpkit as a photo post, etc), then you can *add* the u-photo class to *help* them
#barnabythat reminds me, I need to set the default mf class for uploaded photos in my posts to u-representative, as at the moment all of my images are within the e-content
#barnabyoops yes you’re right. it’s been a while :D
#barnabyheh, the spec even uses both terms: “u-featured - a representative photo”
#[jgmac1106]and barnaby build some tool that will automatically take a u-featured and turn it into OGP kruff for me
#[tantek]aaronpk, adding u-photo *is* helping consumers of that data do something [different] with it, it's indicating that it's a photo post and should be presented with the photo as the focus of the post.
#barnabyI guess I should do a mass find/replace of u-photo with u-featured, too
#[tantek]barnaby huh? only if you intend to change the kind of post
#aaronpk[tantek]: right, in which case if you're going to go to the trouble of adding that, then the photo should not also be in the content
#[tantek]except it's not "also" in the content, it is the content so it makes sense to be inside e-content from a publishing perspective
#aaronpkhas a sore spot from dealing with removing images from content that are also in the photo property when building a reader
#[tantek]yeah that's the challenge worth documenting for sure
#aaronpkmy point is that doubling up the photo is actively making it harder for consumers, which is kind of defeating the purpose of microformats
#aaronpkand in all the other cases it's useful and helpful
#[tantek]from the publisher's perspective, it's not "doubled" so it's wrong to call it that
#barnabyheh, I remember discussing this a while ago. interesting to see that it’s still a talking point. In theory I like the idea of e-content being self-contained, so that consumers can adapt to arbitrary post types by just using e-content as a fallback, and then having more advanced behaviours for additional properties which they support (e.g. recognising that u-photo is duplicated in e-content, and making sure that it’s only
#aaronpkthen there's something fundamentally wrong with the microformats parsing rules
#jacky^ but even in that case, if the photo's doubly tagged, does the photo-specific app _now_ have to scan the HTML for values existing in `photo` and prune them?
#[tantek]this is a problem specific to a particular kind of reader, not a problem with mf2 parsing
#aaronpkright jacky, a consumer sees the "photo" property and is like cool this is a photo post. and then if it also decides to display the content, now the photo appears twice
#aaronpkif you're saying the content property can be treated *only* as a fallback, then that's useful
#aaronpkbut if the content property is expected to have something useful when there is also a photo property, there's the problem
#jackyyeah this actually makes me reconsider how I'd mark up my photos then
#aaronpkif you want to have fallback behavior for consumers that don't understand a specific property, then that fallback should be able to be ignored when consuming the new property
#[tantek]and there can be useful things in content that are beyond the photo that you don't display immediately
#[tantek]e.g. a photo grid display reader view only displays the photos
#aaronpkthat's my point, there *shouldnt* be if you want to be able to do what you're describing
jacky joined the channel
#[tantek]clicking on a photo would show the entire photo post, which presumably if you want to show it in context of other text, etc, then the content makes sense for that
#[tantek]either you're showing a photo-only view (use u-photo), or you're showing all the content (e-content)
#[tantek]so it's confusing why there was this push to show both in the reader at the same time as if they are separate things
#aaronpkbecause i want the reader to show the photos from all posts consistently rather than however they might appear inside HTML
#aaronpkwhat you're describing works if you only have: a view of photos with no content, and separately a view of content while ignoring the "photo" property
#[tantek]that's a MUCH harder problem. you don't get to pick how a publishers shows photos vs captions etc.
#[tantek]photo for preview, content for full display
#aaronpklike even just say you want to replicate the instagram UI, you can't do that right now without going through all the hoops i've had to do to remove the photo from the content
#[tantek]reformatting the content from an author is out of scope IMO, at least for any microformats / typical use-cases
#aaronpk"photo for preview, content for full display" is extremely limiting in building useful UIs
#aaronpkbasically it forces me to treat every post as if it could always be a full blog post with arbitrary formatting and layout
#[tantek]yes, and I think that's an accurate view of what posts are!
#aaronpknot to mention then i have to special case the opposite situation where there is a photo property that doesn't appear in the content
#barnabyis checking and removing duplicate photos from content really a lot of hassle? IIRC the URLs in e-content should be resolved by the mf parser and therefore guaranteed to be the same as the photo property, so it should be a case of checking for img or picture elements matching photo properties and removing them if you want to do something specific with the photos
#[tantek]it's not about "having it both ways". like I said, reformatting author published content is way out of scope for typical use-cases (and things people want to bother trying to code). it's also horribly fragile
#aaronpkbarnaby: the simple case isn't that bad if you're willing to use an HTML parser, but then there are the edge cases
#aaronpki never said anything about reformatting author content
#Loqi[aaronpk] #52 Remove images from posts containing a photo
#[tantek]I feel this is not going to get resolved again until we get an in-person IWC
#barnabyIMO every time you touch untrusted HTML content, there’s already so much sanitization steps which you need to jump through, that adding mf-specific behaviour like this isn’t a big deal
#aaronpki feel this is never going to get resolved 😂
#aaronpkbarnaby: read the thread, i'm stuck on some stuff with alt text and microformats right now :P
#barnabyand is necessary to handle the inevitable diversity of markup styles which are gonna show up in the real world
#[tantek]focusing on the "how do I remove u-photo from e-content" is completely missing the broader contexts of what publishers do what they do, and the simpler reader use-cases I listed above
#aaronpk[tantek]: what you described means i can't have my reader work the way it currently does
#[tantek]so we're not going to solve this with a singular issue thread like that. or rather any attempt to do so is going to disproportionately twist a design/solution to fit that and neglect the broader use-cases and ecosystem
#aaronpkso if that's how this gets resolved then i will be very unhappy but it will be possible to change it
#[tantek]and folks publishing photo posts will either care how their photo posts show up in readers which are doing simple but predictable things or they won't
#aaronpkand by "work the way it does" i mean the UI part, not the plumbing
#[tantek]the problem here AFAICT is jumping straight to narrow issue discussion without documenting the broader use-cases and how people publish what they do
#aaronpki don't think that discussion has been narrow at all
#aaronpkit links out to like 5 other issues across a couple different repos too
#barnabyI definitely agree that mf2 plaintext parsing of alt text and image urls creates some problems
#barnabyit’s especially a pity that image alt text is separated from the u-photo property, resulting in consumers not being able to accurately recreate the original markup
#barnabywhich could also be an accessibility issue
#barnabybut maybe this has already been discussed and I’m out of date?
#[tantek]the discussion has been too plumbing-focused from what I've seen. e.g. we don't have screenshots for different use-cases for publishing & presenting in readers etc.
binyamin[m], rrix, vladimyr, LaBcasse[m] and ermahgerddavid[m joined the channel
#[tantek]barnaby, pretty sure the alt text in images has been handled for quite some time, in a way that makes it possible to recreate (i.e. they're kept together)
#Loqi[aaronpk] #16 consider not including img alt text as part of surrounding text properties
#[tantek]like I think we had to solve that for Micropub back in the day at W3C
#Loqi[tantek] Resolution: issue 2 proposal accepted.
No objections in above discussion, and positive opinions (👍) from a few implementors on the proposal. Proposal text incorporated into spec and reviewed.
Proposal implementation in mf2py parser, test cases p...
#barnaby!tell gRegor heya, any objections to me moving https://github.com/microformats/php-mf2/issues/184 to the 0.5.1 milestone and wrapping up the 0.5.0 release? it’s been four years since 0.4.6, and there’s easily enough features and fixes to justify a release IMO
#barnabymaybe I’ll take the opportunity to set up some github actions on php-mf2 for testing and linting. I really like how the actions for my indieauth and micropub libraries turned out
#aaronpkoh yeah we lost those with travis didn't we
#barnabyif the 1998 in the URL is accurate then the feature is younger than me, but my first HTML book definitely taught <a name="">
#barnabystruck me as a bit weird to use <a> for two completely different things even at the time
#aaronpki thought the browser behavior of jumping down to the matching id= attribute based on the query string fragment was relatively newer than the actual id attribute
mambang[m] joined the channel
#[tantek]aaronpk it's been true since 1999 at least, we shipped it in IE4.5 Mac (if not IE4 Mac in 1998)