Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions website/client/components/Home/PackButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
:class="{ 'pack-button--loading': loading }"
:disabled="!isValid && !loading"
:aria-label="loading ? 'Cancel processing' : 'Pack repository'"
type="submit"
:type="loading ? 'button' : 'submit'"
@click="handleClick"
Comment on lines +7 to 8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

While this change correctly enables keyboard interaction for cancelling, the visual feedback (changing the background to red and showing the 'Cancel' text) is currently only triggered by the :hover state in the CSS. For a better keyboard experience, consider applying these styles to the :focus-visible state as well, so keyboard users get the same visual cue when the button is focused during processing.

>
<span class="pack-button__text pack-button__text--normal">
Expand All @@ -28,8 +28,9 @@ const props = defineProps<{
const emit = defineEmits<(e: 'cancel') => void>();

function handleClick(event: MouseEvent) {
// Only handle cancel on actual mouse clicks, not on form submission (Enter key)
if (props.loading && event.detail > 0) {
// type=button while loading prevents form submission, so any click
// (mouse or keyboard) safely signals cancel.
if (props.loading) {
event.preventDefault();
event.stopPropagation();
emit('cancel');
Expand Down
Loading