Skip to content

Commit 4461fc8

Browse files
authored
fix: do not effect the number input on scroll (#4967)
1 parent 915b973 commit 4461fc8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/writeData/subscriptions/components/BrokerFormContent.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ const BrokerFormContent: FC<Props> = ({
5353
useEffect(() => {
5454
updateForm({...formContent, protocol: protocol.toLowerCase()})
5555
}, [protocol])
56+
57+
useEffect(() => {
58+
const numberInput = document.getElementById(
59+
`${className}-broker-form--port`
60+
)
61+
numberInput?.addEventListener('mousewheel', function(evt) {
62+
evt.preventDefault()
63+
})
64+
}, [])
5665
return (
5766
<Grid>
5867
<Grid.Row>
@@ -181,7 +190,7 @@ const BrokerFormContent: FC<Props> = ({
181190
type={InputType.Text}
182191
placeholder="0.0.0.0"
183192
name="host"
184-
autoFocus={true}
193+
autoFocus={false}
185194
value={formContent.brokerHost}
186195
onChange={e => {
187196
updateForm({
@@ -214,7 +223,7 @@ const BrokerFormContent: FC<Props> = ({
214223
type={InputType.Number}
215224
placeholder="1883"
216225
name="port"
217-
autoFocus={true}
226+
autoFocus={false}
218227
value={formContent.brokerPort}
219228
onChange={e => {
220229
updateForm({
@@ -232,6 +241,7 @@ const BrokerFormContent: FC<Props> = ({
232241
status={edit ? status : ComponentStatus.Disabled}
233242
maxLength={5}
234243
testID={`${className}-broker-form--port`}
244+
id={`${className}-broker-form--port`}
235245
/>
236246
)}
237247
</Form.ValidationElement>

0 commit comments

Comments
 (0)