Commit 01b5d885 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch '29414-fix-toggle-discussion-link-jump' into 'master'

Fix link togglers jumping to top

Closes #29414

See merge request !9918
parents 520f7cd0 cf3c4398
......@@ -18,7 +18,7 @@
// Button does not change visibility. If button has icon - it changes chevron style.
//
// %div.js-toggle-container
// %a.js-toggle-button
// %button.js-toggle-button
// %div.js-toggle-content
//
$('body').on('click', '.js-toggle-button', function(e) {
......
......@@ -431,6 +431,21 @@
border-bottom: none;
}
.diff-stats-summary-toggler {
padding: 0;
background-color: transparent;
border: 0;
color: $gl-link-color;
transition: color 0.1s linear;
&:hover,
&:focus {
outline: none;
text-decoration: underline;
color: $gl-link-hover-color;
}
}
// Mobile
@media (max-width: 480px) {
.diff-title {
......
......@@ -60,7 +60,17 @@
}
.modify-merge-commit-link {
padding: 0;
background-color: transparent;
border: 0;
color: $gl-text-color;
&:hover,
&:focus {
text-decoration: underline;
}
}
.merge-param-checkbox {
......
......@@ -410,8 +410,22 @@ ul.notes {
}
.discussion-toggle-button {
padding: 0;
background-color: transparent;
border: 0;
line-height: 20px;
font-size: 13px;
transition: color 0.1s linear;
&:hover {
color: $gl-link-color;
}
&:focus {
text-decoration: underline;
outline: none;
color: $gl-link-color;
}
.fa {
margin-right: 3px;
......
......@@ -8,7 +8,7 @@
.discussion.js-toggle-container{ class: discussion.id, data: { discussion_id: discussion.id } }
.discussion-header
.discussion-actions
= link_to "#", class: "note-action-button discussion-toggle-button js-toggle-button" do
%button.note-action-button.discussion-toggle-button.js-toggle-button{ type: "button" }
- if expanded
= icon("chevron-up")
- else
......
......@@ -24,7 +24,7 @@
.visible-xs-inline
= render_commit_status(commit, ref: ref)
- if commit.description?
%a.text-expander.hidden-xs.js-toggle-button ...
%button.text-expander.hidden-xs.js-toggle-button{ type: "button" } ...
- if commit.description?
%pre.commit-row-description.js-toggle-content
......
.js-toggle-container
.commit-stat-summary
Showing
= link_to '#', class: 'js-toggle-button' do
%button.diff-stats-summary-toggler.js-toggle-button{ type: "button" }
%strong= pluralize(diff_files.size, "changed file")
with
%strong.cgreen #{diff_files.sum(&:added_lines)} additions
......
......@@ -37,7 +37,7 @@
= check_box_tag :should_remove_source_branch
Remove source branch
.accept-control
= link_to "#", class: "modify-merge-commit-link js-toggle-button" do
%button.modify-merge-commit-link.js-toggle-button{ type: "button" }
= icon('edit')
Modify commit message
.js-toggle-content.hide.prepend-top-default
......
......@@ -76,7 +76,7 @@
Gitea
%div
- if git_import_enabled?
= link_to "#", class: 'btn js-toggle-button import_git' do
%button.btn.js-toggle-button.import_git{ type: "button" }
= icon('git', text: 'Repo by URL')
.import_gitlab_project
- if gitlab_project_import_enabled?
......
---
title: Update toggle buttons to be <button>
merge_request:
author:
......@@ -19,7 +19,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
expect(page).to have_link('Bitbucket')
expect(page).to have_link('GitLab.com')
expect(page).to have_link('Google Code')
expect(page).to have_link('Repo by URL')
expect(page).to have_button('Repo by URL')
expect(page).to have_link('GitLab export')
end
......
......@@ -382,7 +382,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I modify merge commit message' do
find('.modify-merge-commit-link').click
click_button "Modify commit message"
fill_in 'commit_message', with: 'wow such merge'
end
......
......@@ -296,7 +296,7 @@ feature 'Diff notes resolve', feature: true, js: true do
it 'displays next discussion even if hidden' do
page.all('.note-discussion').each do |discussion|
page.within discussion do
click_link 'Toggle discussion'
click_button 'Toggle discussion'
end
end
......@@ -477,13 +477,13 @@ feature 'Diff notes resolve', feature: true, js: true do
it 'shows resolved icon' do
expect(page).to have_content '1/1 discussion resolved'
click_link 'Toggle discussion'
click_button 'Toggle discussion'
expect(page).to have_selector('.line-resolve-btn.is-active')
end
it 'does not allow user to click resolve button' do
expect(page).to have_selector('.line-resolve-btn.is-disabled')
click_link 'Toggle discussion'
click_button 'Toggle discussion'
expect(page).to have_selector('.line-resolve-btn.is-disabled')
end
......
......@@ -41,7 +41,7 @@ feature 'Clicking toggle commit message link', feature: true, js: true do
visit namespace_project_merge_request_path(project.namespace, project, merge_request)
expect(textbox).not_to be_visible
click_link "Modify commit message"
click_button "Modify commit message"
expect(textbox).to be_visible
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment