Closed Bug 1387022 Opened 7 years ago Closed 7 years ago

Sidebar switcher button stays in active state after it's clicked with the intention to hide the switcher panel

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 57
Tracking Status
firefox57 --- fixed

People

(Reporter: nhnt11, Assigned: nhnt11)

Details

Attachments

(1 file)

STR:

1. Click sidebar switcher button to open the switcher panel
2. Click the switcher button again to close it

Expected:

Switcher button is no longer in active state

Actual:

Switcher button remains in active state after panel is closed


The panel closes when you click outside of it, so when you click the button, it closes, and then the code to toggle it is called - we end up calling showSwitcherPanel, which is bad.
Assignee: nobody → nhnt11
Status: NEW → ASSIGNED
Comment on attachment 8893359 [details]
Bug 1387022 - Don't attempt to show the sidebar switcher panel if it's closing.

https://reviewboard.mozilla.org/r/164454/#review169730

::: browser/base/content/browser-sidebar.js:80
(Diff revision 1)
>      if (this._switcherPanel.state == "open" || this._switcherPanel.state == "showing") {
>        this.hideSwitcherPanel();
> -    } else {
> +    } else if (this._switcherPanel.state == "closed") {
>        this.showSwitcherPanel();
>      }

Can we simplify to:

```
if (.state == 'closed') {
  show();
} else {
  hide();
}
```

or does that break stuff? Either way, r=me
Attachment #8893359 - Flags: review?(gijskruitbosch+bugs) → review+
(In reply to :Gijs from comment #2)
> Comment on attachment 8893359 [details]
> Bug 1387022 - Don't attempt to show the sidebar switcher panel if it's
> closing.
> 
> https://reviewboard.mozilla.org/r/164454/#review169730
> 
> ::: browser/base/content/browser-sidebar.js:80
> (Diff revision 1)
> >      if (this._switcherPanel.state == "open" || this._switcherPanel.state == "showing") {
> >        this.hideSwitcherPanel();
> > -    } else {
> > +    } else if (this._switcherPanel.state == "closed") {
> >        this.showSwitcherPanel();
> >      }
> 
> Can we simplify to:
> 
> ```
> if (.state == 'closed') {
>   show();
> } else {
>   hide();
> }
> ```
> 
> or does that break stuff? Either way, r=me

We'd still need to check that it's not closing in the else, so I'm going to leave it how it is.
Pushed by nhnt11@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/b5e38bafb4ed
Don't attempt to show the sidebar switcher panel if it's closing. r=Gijs
https://hg.mozilla.org/mozilla-central/rev/b5e38bafb4ed
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 57
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: