Skip to content

Commit

Permalink
use <label> for link color picker
Browse files Browse the repository at this point in the history
  • Loading branch information
le-jeu committed Oct 31, 2023
1 parent 996fb92 commit ac4e05a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/code/ui/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@ export function displayFormat(
d.appendChild(
PortalUI.displayFormat(operation.getPortal(link.fromPortalId), smallScreen)
);
const arrow = L.DomUtil.create("span", "wasabee-link-seperator", d);
const arrow = L.DomUtil.create("label", "wasabee-link-seperator", d);
arrow.style.color = convertColorToHex(link.getColor(operation));
arrow.htmlFor = `linkpicker-${link.ID}`;
appendFAIcon("carret-right", arrow);
const picker = L.DomUtil.create("input", "hidden-color-picker", arrow);
picker.id = `linkpicker-${link.ID}`
picker.type = "color";
picker.value = convertColorToHex(link.getColor(operation));
picker.setAttribute("list", "wasabee-colors-datalist");
picker.disabled = !operation.canWrite();

L.DomEvent.on(arrow, "click", () => {
picker.click();
});

L.DomEvent.on(picker, "change", (ev) => {
const color = (ev.target as HTMLInputElement).value;
link.setColor(color, operation);
Expand Down

0 comments on commit ac4e05a

Please sign in to comment.