Skip to content

Commit bec2535

Browse files
fix(core): add property to disable wheel event for Step Input (#13503)
1 parent 9a92338 commit bec2535

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

libs/core/step-input/step-input.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
[attr.aria-required]="required"
4343
[attr.aria-roledescription]="ariaRoleDescription || ('coreStepInput.ariaRoleDescription' | fdTranslate)"
4444
(focusin)="handleFocusIn()"
45-
(wheel)="handleScroll($event)"
45+
(wheel)="!disableWheel && handleScroll($event)"
4646
(keydown)="handleKeyDown($event)"
4747
(input)="trackInputValue($event)"
4848
(change)="updateOnInputChanged()"

libs/core/step-input/step-input.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
Output,
1717
ViewChild,
1818
ViewEncapsulation,
19+
booleanAttribute,
1920
forwardRef,
2021
isDevMode
2122
} from '@angular/core';
@@ -156,6 +157,10 @@ export class StepInputComponent implements OnInit, AfterViewInit, OnDestroy, Con
156157
@Input()
157158
inputTitle = '';
158159

160+
/** Whether the wheel event should be disabled. Default value is false */
161+
@Input({ transform: booleanAttribute })
162+
disableWheel = false;
163+
159164
/** Sets formatting mode */
160165
@Input()
161166
mode: 'decimal' | 'currency' = 'decimal';

libs/docs/core/step-input/examples/step-inpt-default-example/step-input-default-example.component.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@ import { StepInputModule } from '@fundamental-ngx/core/step-input';
2020
</div>
2121
</div>
2222
<br />
23-
<div class="step-input-example-container" [style.width.%]="100">
23+
<div class="step-input-example-container" [style.justify-content]="'space-between'">
2424
<div class="step-input-example">
2525
<label fd-form-label for="full-width-input">Full Width</label>
2626
<fd-step-input inputId="full-width-input" [isFullWidth]="true" [(value)]="value3"></fd-step-input>
2727
<small>Value: {{ value3 }}</small>
2828
</div>
29+
30+
<div class="step-input-example">
31+
<label fd-form-label for="input-wheel">Disabled wheel event</label>
32+
<fd-step-input disableWheel inputId="input-wheel" [(value)]="value4"></fd-step-input>
33+
<small>Value: {{ value4 }}</small>
34+
</div>
2935
</div>
3036
`,
3137
imports: [FormLabelComponent, StepInputModule, ContentDensityDirective]
@@ -34,4 +40,5 @@ export class StepInputDefaultExampleComponent {
3440
value1: number | null = 0;
3541
value2: number | null = 0;
3642
value3: number | null = 0;
43+
value4: number | null = 0;
3744
}

0 commit comments

Comments
 (0)