arsenaltech / nova-tab

Laravel Nova Tabs
74 stars 17 forks source link

Page scrolling to anchor when content is too long #13

Open XGhozt opened 5 years ago

XGhozt commented 5 years ago

I'm not sure if this is just on my end or not. This should be disabled though. There's no need to scroll the page to the anchor when switching tabs. This is just the default behavior when clicking links with anchors.

shabbirbharmal commented 5 years ago

That's right, it is just default behavior.

XGhozt commented 5 years ago

@shabbirbharmal -- Yes, but it should be disabled. Why did you close this?

https://vuejs.org/v2/guide/events.html

event.stopPropagation()

shabbirbharmal commented 5 years ago

Because that is the default behavior of tab component I am using and I didn't see any option to change it or make it configurable. Let me know if you think we are not on the same page with the issue you are facing.

XGhozt commented 5 years ago

It doesn't need to be a configurable option. The page simply shouldn't move at all when you change tabs. Just like most other websites. A good example is github right here when you add a reply, there is a "Write" and "Preview" tab on the editor. The page doesn't scroll.

If the page moves when users are clicking a tab, it's very disorienting and the first thing they will do is scroll back up. I'm not familiar enough with Vue or Nova to get this installed. Bust in native javascript or any other library it's usually a one liner added to the click event to disable the browsers default behavior.

XGhozt commented 5 years ago

Is this what you're using?

https://github.com/spatie/vue-tabs-component

It doesn't happen in the demo on that website. Can you confirm it's happening in your Laravel Nova installation, too?

Demo: http://vue-tabs-component.spatie.be/

shabbirbharmal commented 5 years ago

I see what is happening here. URL fragment is conflicting with Nova's Vue router. Will have to disable URL fragment to fix this

XGhozt commented 5 years ago

Awesome, hopefully it's not to difficult.