Skip to content

Conversation

@huntertur
Copy link
Contributor

@huntertur huntertur commented Dec 27, 2024

Implements parts of #1477.

These changes will:

  • Make editor and published link orientation consistent
  • Add support for optional labels on links
  • Show icons for most recognized services
    • No DeviantArt since it wants me to start a partnership with them over email before getting access to a brand kit
    • No Steam due to the following restriction in its brand rules: "The Logo must stand alone and may not be combined with any object, including but not limited to other logos, words, graphics, photos, slogans, numbers, design features, or symbols."
    • No YouTube because it wants me to fill out a whole form, including an employer name, to be allowed to use the logo for any purpose
    • Fur Affinity gets the low-resolution favicon instead of the current logo because I was unable to make the rainbow paw splash recognizable at low resolutions
    • The generic globe icon is a public domain asset sourced from here: https://publicdomainvectors.org/en/free-clipart/Earth-silhouette/54347.html
  • Support one-click removal and undoing of removals when scripting is available, supplementing the existing workflow of leaving the name or value blank on form submission to delete an entry
  • Warn if a URL was likely pasted into the name field instead of the value field
  • Automatically extract identifiers from recognized sites, making newly-published links look nice and tracking-free regardless of if the user typed in a username or pasted the whole profile URL
  • Fix an issue in the admin tool for removing a user's contact links where an admin meaning to remove only one of the possibly-multiple links for a given site for a user ends up removing all of them upon form submission due to the form not being specific enough
  • Use a combobox to show available recognized sites and their icons
    • The current <input> + <datalist> approach remains the no-scripting fallback.
    • This is my first time not only using the Web Components API, but also making a serious effort to programmatically set ARIA attributes, following the W3C guidelines for comboboxes. Because of this, it is more than possible that some of my implementation decisions here are questionable. Please let me know if I did something wrong :)

New editor, scripting-enabled

image

New editor, no scripting

Not pictured: <datalist> is still the user's friend.

image

Published side

Notice the labels on two of the Bluesky links.

image

@huntertur huntertur added enhancement ui javascript Dependabot pull requests for JavaScript dependencies labels Dec 27, 2024
@huntertur huntertur requested a review from charmander December 27, 2024 17:57
@huntertur
Copy link
Contributor Author

Re-tested this tonight after rebasing the branch. The one potential issue I can find is that switching to keyboard navigation can cause the page to scroll. Testing with small resolutions shows this is because the browser (at least for Firefox) wants to make the combobox be at the top of the page, if there is enough room. I'm unsure if this is an issue with my PR, or if this is expected behavior on the part of the browser. ^^;

@charmander charmander removed the javascript Dependabot pull requests for JavaScript dependencies label May 3, 2025
@codecov

This comment was marked as outdated.

- add spacing between cells
- avoid table width discontinuity over viewport widths
- stop buttons from overflowing their cells
- set vertical alignment on table headers for when their text wraps
…mpts to read it

`main.js` loads asynchronously, so if it’s cached, it can upgrade the `<input is="weasyl-combobox">` before its `list` is in the DOM.

this.#popover.style.top = `${top}px`;
this.#popover.style.left = `${left}px`;
this.#popover.style.maxHeight = `${rect.height * 6.7}px`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.7 to emphasize that it’s scrollable? Nice touch :)

When the field has history, it gets a datalist-like dropdown arrow and additional popover that eats keyboard input on Chrome, for example.
We probably still want a custom icon if we proceed with this icon-button approach, but I’m just noting that this exists.
to expose a hover tooltip. This doesn’t help all users, but it should be a straight improvement.
Copy link
Contributor

@charmander charmander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial list of things that still need work (which I meant to get to sooner, but there’s a lot going on right now – will take care of eventually):

  • Almost every site icon should be an SVG (Itaku and Inkbunny are acceptable exceptions), with an appropriate level of detail for the display size (Reddit is too detailed; Piczel’s SVG should be less detailed than its 300 KB PNG), and optimized. We should use SoFurry’s new logo.
  • Safari doesn’t support extending built-in elements with <input is="…">. Have we made an explicit decision about not supporting it?
  • scrollIntoView (regardless of options, I think?) doesn’t behave the same way as native dropdown lists.
  • Table layout on narrow viewports. I don’t remember if I broke this by making it wider, but it’s important either way.
  • We might want to implement a preview. It could apply sorting (highlight focused row) and display the URL to help catch mistakes. This could also be added later, though – maybe along with the future link verification feature.
  • TODO: check dynamic fields’ interaction with bfcache/form state cache – is a beforeunload warning more important on this page?
  • Is the disabled state clear enough for delete undo? We could hide the fields and replace the entire row with a <td rowspan="3">Item deleted. <button class="link-button" type="button">Undo</button></td>.
  • We could suggest links to import from the profile text?
  • Emoji/Unicode symbols in UI typically don’t look very professional. We’ll probably want to replace any remaining ones with SVG icons.

I’m going to push some changes directly here instead of opening a pull request for simplicity, but feel free to revert any.

}

function addNewSocialGroupIfNeeded() {
if (this.querySelectorAll('input[value]')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is always true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants