Skip to content

Commit

Permalink
improvement: allow controlling scroll bars with the keyboard without …
Browse files Browse the repository at this point in the history
…clicking first

closes #55
  • Loading branch information
NathanLovato committed Jan 30, 2022
1 parent 05fb90a commit 1090f14
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ui/UILesson.gd
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ func _ready() -> void:
child.show()
_practices_container.show()

_scroll_container.grab_focus()


func setup(lesson: Lesson, course: Course) -> void:
if not is_inside_tree():
Expand Down
2 changes: 2 additions & 0 deletions ui/components/CodeEditor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ func _ready() -> void:
yield(get_tree(), "idle_frame")
_initial_text = text

slice_editor.grab_focus()

if not Engine.editor_hint:
for button in _buttons_with_shortcuts:
assert(
Expand Down
5 changes: 5 additions & 0 deletions ui/screens/course_outliner/CourseLessonList.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ const CourseLessonItem := preload("res://ui/screens/course_outliner/CourseLesson
const CourseLessonItemScene := preload("res://ui/screens/course_outliner/CourseLessonItem.tscn")

onready var _lesson_items := $ScrollContainer/MarginContainer/Items as Control
onready var _scroll_container := $ScrollContainer as ScrollContainer


func _ready() -> void:
_scroll_container.grab_focus()


func add_item(lesson_index: int, lesson_title: String, completion: int) -> void:
Expand Down
3 changes: 3 additions & 0 deletions ui/screens/welcome_screen/WelcomeScreen.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ onready var _settings_button := $Layout/MarginContainer/ColumnLayout/SideColumn/
onready var _outliner_button := $Layout/MarginContainer/ColumnLayout/SideColumn/OutlinerButton as Button
onready var _start_button := $Layout/MarginContainer/ColumnLayout/SideColumn/StartButton as Button
onready var _report_button := $Layout/TopBar/MarginContainer/ToolBarLayout/ReportButton as Button
onready var _scroll_container := $Layout/MarginContainer/ColumnLayout/MainColumn/MainContent/MarginContainer/ScrollContainer as ScrollContainer

onready var _main_content_block := $Layout/MarginContainer/ColumnLayout/MainColumn/MainContent as Container
onready var _content_list := (
Expand All @@ -23,6 +24,8 @@ func _ready() -> void:
if child is RichTextLabel:
child.connect("meta_clicked", OS, "shell_open")

_scroll_container.grab_focus()


func set_button_continue(enable: bool = true) -> void:
if enable:
Expand Down

0 comments on commit 1090f14

Please sign in to comment.