Scroll wheel fix again

This commit is contained in:
2026-06-18 20:20:03 +01:00
parent 3f230bb0d7
commit 25c3f1fa64
2 changed files with 20 additions and 2 deletions
+19 -1
View File
@@ -502,6 +502,11 @@ function setupEventListeners() {
const dispenseQuantityInput = document.getElementById('dispenseQuantity');
if (dispenseQuantityInput) {
// Prevent accidental value changes when users scroll while focused.
dispenseQuantityInput.addEventListener('wheel', (event) => {
event.preventDefault();
}, { passive: false });
dispenseQuantityInput.addEventListener('input', () => {
const mode = getSelectedDispenseMode();
if (mode !== 'subunit') {
@@ -524,6 +529,14 @@ function setupEventListeners() {
});
}
const dispensePackCountInput = document.getElementById('dispensePackCount');
if (dispensePackCountInput) {
// Prevent accidental value changes when users scroll while focused.
dispensePackCountInput.addEventListener('wheel', (event) => {
event.preventDefault();
}, { passive: false });
}
// Close modal when clicking outside
window.addEventListener('click', (e) => {
if (e.target.classList.contains('modal')) {
@@ -1279,7 +1292,7 @@ function renderDispenseBatchAllocationRows(activeBatches) {
: 0;
const allocationLabel = mode === 'pack' ? 'Allocate Packs' : 'Allocate';
const allocationMax = mode === 'pack' ? availableFullPacks : getBatchAvailableDispenseQuantity(batch, mode, selectedPack);
const allocationStep = mode === 'pack' ? 1 : 0.1;
const allocationStep = mode === 'pack' ? '1' : '1.0';
const batchAvailabilityNote = mode === 'pack'
? (selectedPack && batchMatchesSelectedPack(batch, selectedPack) && availableFullPacks <= 0
? 'No full packs available in this batch'
@@ -1324,6 +1337,11 @@ function renderDispenseBatchAllocationRows(activeBatches) {
}).join('');
batchInfoContent.querySelectorAll('.dispense-batch-allocation').forEach(input => {
// Prevent accidental value changes when users scroll while focused.
input.addEventListener('wheel', (event) => {
event.preventDefault();
}, { passive: false });
input.addEventListener('input', updateDispenseAllocationSummary);
});
}
+1 -1
View File
@@ -176,7 +176,7 @@
<div class="form-group" id="dispenseQuantityGroup">
<label for="dispenseQuantity">Quantity *</label>
<input type="number" id="dispenseQuantity" step="0.1">
<input type="number" id="dispenseQuantity" step="1.0">
</div>
<div class="form-row" id="dispensePackRow" style="display: none;">