Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

draft: navigation interface #63

Closed
raphamorim opened this issue Nov 19, 2017 · 7 comments
Closed

draft: navigation interface #63

raphamorim opened this issue Nov 19, 2017 · 7 comments

Comments

@raphamorim
Copy link
Owner

raphamorim commented Nov 19, 2017

Working in Progress in #58 #40

const MyListComponent = (
   <div class="container">
   <div class="list"> 
         <div class="item" focusable onBlur={() => console.log('blur') } >
                Vertical Item with Blur Handler
          </div>
          <div class="horizontal-list">
               <div class="item" focusable onPress={() => console.log('pressed') } >
                     Horizontal Item 1 with Press Handler
               </div>
               <div class="item" focusable focused>
                     Horizontal Item 2 which started focused
                </div>
          </div>
          <div class="item" focusable onFocus={() => console.log('focused') } >
               Vertical Item with Focus Handler
          </div>
          <div class="item">
               Item which can't be focused or selected
           </div>
       </div>
       <div class='button' focusable>
           Enter
       </div>
   </div>
)

References:

@raphamorim
Copy link
Owner Author

cc// @dead

@dead
Copy link
Contributor

dead commented Nov 20, 2017

Looks good to me 😄
Any particular reason to use <div class="list"> instead of something like <div nav-list> ?

There are also other things that I was thinking:

  • When moving to another item using i.e. ◀️ and then pressing ▶️ it should back to the same element it was before. (there are some cases where this would not happen)
  • Lists where an item is "active" and should be focused when entering.
  • How to set an item as active in the navigation tree? (without causing all the list to rerender)

@raphamorim
Copy link
Owner Author

raphamorim commented Nov 20, 2017

Any particular reason to use <div class="list"> instead of something like <div nav-list> ?

Nopes, the only thing that matter for the renderer is focusable prop.

Lists where an item is "active" and should be focused when entering.

This is the idea :octocat: 👍

How to set an item as active in the navigation tree? (without causing all the list to rerender)

For this draft, I'll go on based on props (active) setted by state. But this is still a item for discuss later.

@raphamorim
Copy link
Owner Author

@EloB
Copy link

EloB commented Nov 21, 2017

Nice :)

What will happend if the current focused item unmounts?
Is the coder responsible to move the focus prop?

@raphamorim
Copy link
Owner Author

What will happend if the current focused item unmounts?

Probably will focus on last focused element, if even the last focused element not exists anymore focus the first one.

Is the coder responsible to move the focus prop?

For first version yes @EloB

@raphamorim
Copy link
Owner Author

I ended up making a decision to reuse the Spatial Navigation code.
But I need to readjust the algorithm for the life cycle of a React renderer.

Preview: https://twitter.com/raphamundi/status/933510056678707200

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants