Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
dfaef635
Commit
dfaef635
authored
Sep 19, 2015
by
clrux
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9140 from edx/clrux/ux-2620-new-post-focus
Assigning focus to the selected topic
parents
c0eccb07
f63ff690
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
common/static/coffee/spec/discussion/view/discussion_thread_view_spec.coffee
+12
-0
common/static/coffee/src/discussion/views/discussion_thread_view.coffee
+1
-0
common/static/common/templates/discussion/thread.underscore
+2
-2
No files found.
common/static/coffee/spec/discussion/view/discussion_thread_view_spec.coffee
View file @
dfaef635
...
...
@@ -158,6 +158,18 @@ describe "DiscussionThreadView", ->
expect
(
$
.
ajax
).
not
.
toHaveBeenCalled
()
expect
(
@
view
.
$el
.
find
(
".responses li"
).
length
).
toEqual
(
0
)
describe
"focus"
,
->
it
"sends focus to the conversation when opened"
,
->
DiscussionViewSpecHelper
.
setNextResponseContent
({
resp_total
:
0
,
children
:
[]})
@
view
.
render
()
@
view
.
expand
()
waitsFor
(
->
# This is the implementation of "toBeFocused". However, simply calling that method
# with no wait seems to be flaky.
article
=
@
view
.
$el
.
find
(
'.discussion-article'
)
return
article
[
0
]
==
article
[
0
].
ownerDocument
.
activeElement
),
"conversation did not receive focus"
,
3000
describe
"expand/collapse"
,
->
it
"shows/hides appropriate content"
,
->
DiscussionViewSpecHelper
.
setNextResponseContent
({
resp_total
:
0
,
children
:
[]})
...
...
common/static/coffee/src/discussion/views/discussion_thread_view.coffee
View file @
dfaef635
...
...
@@ -162,6 +162,7 @@ if Backbone?
)
@
trigger
"thread:responses:rendered"
@
loadedResponses
=
true
@
$el
.
find
(
'.discussion-article[data-id="'
+
@
model
.
id
+
'"]'
).
focus
()
# Sends focus to the discussion once the thread loads
error
:
(
xhr
,
textStatus
)
=>
return
if
textStatus
==
'abort'
...
...
common/static/common/templates/discussion/thread.underscore
View file @
dfaef635
<article class="discussion-article" data-id="<%- id %>">
<div class="thread-wrapper"
tabindex="-1"
>
<article class="discussion-article" data-id="<%- id %>"
tabindex="-1"
>
<div class="thread-wrapper">
<div class="forum-thread-main-wrapper">
<div class="thread-content-wrapper"></div>
<div class="post-extended-content">
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment