Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DTRA-2055 / Kate / [DTrader-V2] Trade page scrolling issue #17176
DTRA-2055 / Kate / [DTrader-V2] Trade page scrolling issue #17176
Changes from 6 commits
de6d148
d6869ad
5653cdf
07ace6b
ed2bfb1
7720db9
2489a85
bb11ae6
29a6db7
b3488aa
33f6fb4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any chance to find solution which does not require to remember to remove focus from every single element? it feels like a recipe for sneaky bugs, I'm sure ppl will forget and it will sneak through the PRs.
The same way missing dependencies in useHook sneaks through all the time and causes sneaky bugs all the time. Everyone knows about useEffect dependencies, but ppl still forget to add them and miss them in reviews, so basically its a source of bugs and unnecessary overhead in reviews.
cc @kate-deriv @nijil-deriv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to rework, @nijil-deriv gave me a tip to think about wrapper. The idea is to wrap all trade params with wrapper and inside that wrapper to track focus. If it'll be inside input, then remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on comments I did another solution, could you please check?
Link
What was done:
TradeParameters
(in packages/trader/src/AppV2/Components/TradeParameters/trade-parameters.tsx) is a container for all trade parameters, so inside ofuseEffect
I added an event listener forfocusin
. Ifevent.target
contains specific custom attribute (data-focus
), then I'll remove focus.Custom attributes (
data-focus
) were added for all trade params inputs. That was the only way that works for me to indicate that it's correct input. We can't just remove focus from all inputs inside trade params components as user won't be able to even type something for stake, barrier and etc@wojciech-deriv @nijil-deriv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If alternative solution will melt your hearts, I'll merge that branch into a current one