Attach a review note to a UI element
FixKit lets a developer point at an element in a simulator and describe a change. Pair the review note with a stable component ID.
Attach a revision note to a long-pressed component
An independent web example inspired by the original reference.
Long-press “Place order” or press “Add a review note,” then record it with the target attached.
Implementation steps
- Assign a stable ID to the target component and record it with the comment. The sample uses the button's ID.
- Open the note field after a set hold duration. Clear the timer when the finger lifts or scrolling interrupts the gesture.
- Provide a note button usable via keyboard or short tap. In a real app, place this UI in developer mode.
Acceptance check
A short tap doesn't trigger the long press. You can retrieve the note together with the target ID.
View sample code
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Attach a revision note to a long-pressed component</title>
<style>
* { box-sizing: border-box; }
body {
margin: 0;
padding: 16px;
background: #23232a;
color: #f4f0ea;
font: 16px/1.6 system-ui, sans-serif;
}
label, output, strong, audio, progress { display: block; margin: 6px 0; }
input, select, button { max-width: 100%; font: inherit; }
input, select { padding: 4px 7px; }
button {
margin: 4px 0;
padding: 5px 12px;
cursor: pointer;
border: 1px solid #b5a399;
border-radius: 6px;
}
:focus-visible { outline: 3px solid #ffad73; outline-offset: 2px; }
audio { width: 100%; }
[hidden] { display: none !important; }
</style>
</head>
<body>
<button id="checkout">Place order</button>
<button id="annotate">Add a review note</button>
<form id="editor" hidden>
<label>Note for checkout <input id="comment" required></label>
<button>Save note</button>
</form>
<output id="result"></output>
<script>
const target = document.querySelector('#checkout');
const editor = document.querySelector('#editor');
const comment = document.querySelector('#comment');
function openEditor() { editor.hidden = false; comment.focus(); }
let timer;
function cancel() { clearTimeout(timer); }
target.onpointerdown = event => {
cancel();
if (event.isPrimary && event.button === 0) timer = setTimeout(openEditor, 500);
};
for (const type of ['pointerup','pointercancel','pointerleave']) {
target.addEventListener(type, cancel);
}
document.querySelector('#annotate').onclick = openEditor;
editor.onsubmit = event => {
event.preventDefault();
document.querySelector('#result').textContent = target.id + ': ' + comment.value;
editor.hidden = true;
comment.value = '';
};
</script>
</body>
</html>Save as index.html and open in a browser to run it locally.