Skip to content

Commit 1918ffe

Browse files
committed
Added button accessibility behavior to More and Page toolbar buttons.
1 parent dab8605 commit 1918ffe

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

wordpress-comments/src/main/java/org/wordpress/aztec/plugins/wpcomments/toolbar/MoreToolbarButton.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import org.wordpress.aztec.plugins.wpcomments.spans.WordPressCommentSpan
1616
import org.wordpress.aztec.spans.IAztecNestable
1717
import org.wordpress.aztec.toolbar.AztecToolbar
1818
import org.wordpress.aztec.toolbar.IToolbarAction
19+
import org.wordpress.aztec.util.convertToButtonAccessibilityProperties
1920

2021
class MoreToolbarButton(val visualEditor: AztecText) : IToolbarButton {
2122
override val action: IToolbarAction = CommentsToolbarAction.MORE
@@ -54,7 +55,9 @@ class MoreToolbarButton(val visualEditor: AztecText) : IToolbarButton {
5455
}
5556

5657
override fun inflateButton(parent: ViewGroup) {
57-
LayoutInflater.from(context).inflate(R.layout.more_button, parent)
58+
val rootView = LayoutInflater.from(context).inflate(R.layout.more_button, parent)
59+
val button = rootView.findViewById<ToggleButton>(R.id.format_bar_button_more)
60+
button.convertToButtonAccessibilityProperties()
5861
}
5962

6063
override fun toolbarStateAboutToChange(toolbar: AztecToolbar, enable: Boolean) {

wordpress-comments/src/main/java/org/wordpress/aztec/plugins/wpcomments/toolbar/PageToolbarButton.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.text.Spanned
66
import android.view.KeyEvent
77
import android.view.LayoutInflater
88
import android.view.ViewGroup
9+
import android.widget.ToggleButton
910
import org.wordpress.aztec.AztecText
1011
import org.wordpress.aztec.Constants
1112
import org.wordpress.aztec.plugins.IToolbarButton
@@ -14,6 +15,7 @@ import org.wordpress.aztec.plugins.wpcomments.spans.WordPressCommentSpan
1415
import org.wordpress.aztec.spans.IAztecNestable
1516
import org.wordpress.aztec.toolbar.AztecToolbar
1617
import org.wordpress.aztec.toolbar.IToolbarAction
18+
import org.wordpress.aztec.util.convertToButtonAccessibilityProperties
1719

1820
class PageToolbarButton(val visualEditor: AztecText) : IToolbarButton {
1921

@@ -49,7 +51,9 @@ class PageToolbarButton(val visualEditor: AztecText) : IToolbarButton {
4951
}
5052

5153
override fun inflateButton(parent: ViewGroup) {
52-
LayoutInflater.from(context).inflate(R.layout.page_button, parent)
54+
val rootView = LayoutInflater.from(context).inflate(R.layout.page_button, parent)
55+
val button = rootView.findViewById<ToggleButton>(R.id.format_bar_button_page)
56+
button.convertToButtonAccessibilityProperties()
5357
}
5458

5559
override fun toolbarStateAboutToChange(toolbar: AztecToolbar, enable: Boolean) {

0 commit comments

Comments
 (0)