Skip to content
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

fix(module:slider): drag, select, focus and rapid reposition fix #903

Merged
merged 5 commits into from
Dec 21, 2020

Conversation

anddrzejb
Copy link
Member

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • Bundle size optimization
  • Performance optimization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

This addresses a number of small issues with slider:

  1. When clicked and dragged to the left, often before first movement to the left a movement to the right was executed:
    slider_goes_back_on_click

  2. When dragging, especially after page load, nothing was happening:
    slider_drag_lag

  3. For ranged slider, when dragging one edge beyond the other range, the focus was not following (I am referring to transparent gradient border that is showing when edge gets focus) :
    slider_focus_fix

  4. For ranged slider, when quickly dragging one edge beyond the other edge, the "not changed" edge also moves:
    slider_non_active_edge_not_locked

  5. When dragging an edge, text selection should be inactive:
    slider_drag_and_select

💡 Background and solution

  1. Required changes to calculation method of the edge position.
  2. Previously added method IsMoveInEdgeBoundary was removed from OnMouseMove event handler.
  3. When side switch is discovered, a js focus method is called on appropriate edge.
  4. When ranged slider is used, original values of each edge are stored when mouse down is registered. During side switch, the stored values are persisted, to ensure they do not change.
  5. Added to class @{slider-prefix-cls} css user-select:none

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Changelog is provided or not needed

remove unnecessary check from OnMouseMove
change position calculation - remove handle size
@codecov-io
Copy link

codecov-io commented Dec 19, 2020

Codecov Report

Merging #903 (fd519c5) into master (3f8a5a7) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #903      +/-   ##
=========================================
- Coverage    5.55%   5.54%   -0.02%     
=========================================
  Files         400     400              
  Lines       21300   21331      +31     
=========================================
- Hits         1184    1182       -2     
- Misses      20116   20149      +33     
Impacted Files Coverage Δ
components/slider/Slider.razor 0.00% <0.00%> (ø)
components/slider/Slider.razor.cs 0.00% <0.00%> (ø)
components/tabs/Tabs.razor.cs 55.51% <0.00%> (-0.82%) ⬇️
components/input/Input.cs 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3f8a5a7...fd519c5. Read the comment docs.

@ElderJames
Copy link
Member

Thank you @anddrzejb for the great contribution.
Everything is good but the style changing is not a good idea, because the styles are synchronized from the ant-design.
So it's best to go there repo and fix the style.

@anddrzejb
Copy link
Member Author

So I see 1 option then: hard code it in the slider div in the style attribute. Do you agree @ElderJames ?

@ElderJames
Copy link
Member

So I see 1 option then: hard code it in the slider div in the style attribute. Do you agree @ElderJames ?

@anddrzejb It's OK.

@ElderJames ElderJames merged commit 5365b10 into ant-design-blazor:master Dec 21, 2020
@anddrzejb anddrzejb deleted the sliderDragLagFix branch December 21, 2020 09:35
ElderJames added a commit that referenced this pull request Apr 23, 2022
* fix(module:slider): drag lag and reposition fix

remove unnecessary check from OnMouseMove
change position calculation - remove handle size

* fix(module:slider): text select issue while slider drag fix

* fix: remove the style

* clean value

* fix(module:slider): text select while slider drag fix

Co-authored-by: ElderJames <shunjiey@hotmail.com>
ElderJames added a commit that referenced this pull request Apr 30, 2022
* fix(module:slider): drag lag and reposition fix

remove unnecessary check from OnMouseMove
change position calculation - remove handle size

* fix(module:slider): text select issue while slider drag fix

* fix: remove the style

* clean value

* fix(module:slider): text select while slider drag fix

Co-authored-by: ElderJames <shunjiey@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants