Lock body scroll when modal is open globally #2241

Closed
tae wants to merge 0 commits from gitlab-mr-iid-974 into develop
Member

for the status posting modal and the user reporting modal

for the status posting modal and the user reporting modal
Member

no need for viewClass, you can just specify class normally and vue will append it for you, i.e. <Modal class="x"> will become <div class="modal-view x">

no need for viewClass, you can just specify class normally and vue will append it for you, i.e. `<Modal class="x">` will become `<div class="modal-view x">`
Member

maybe animation should also moved here as well?

maybe animation should also moved here as well?
Member

it doesn't actually close it, so probably it shouldn't be called close? Same with method, maybe something like backdropClicked?

it doesn't actually close it, so probably it shouldn't be called close? Same with method, maybe something like `backdropClicked`?
Member

what

what
Member

is this change necessary?

is this change necessary?
Member

maybe use a Set?

maybe use a `Set`?
Member

can it be more explicit, like lockerEls.length === 0?

can it be more explicit, like `lockerEls.length === 0`?
Member

you mean >= 1, right?

you mean `>= 1`, right?
Author
Member

to prevent modal from moving horizontally while locking body scroll

to prevent modal from moving horizontally while locking body scroll
Author
Member

yes, necessary to set higher specificity to this CSS

yes, necessary to set higher specificity to this CSS
Author
Member

well, do you have any issue with the current one?

well, do you have any issue with the current one?
Author
Member

yes, it can be

yes, it can be
Author
Member

updated

updated
Author
Member

no, it is <=

no, it is `<= `
Member

It looks like you're trying to replicate Set behavior using an array, it would be more efficient to just use Set instead. Apart from possible performance boost (Array.includes is worst-case O(n), Set.has is O(1)) it would give clearer code - no need to check if object reference already exists in set it doesn't get duplicated since Set already enforces uniqueness of all of its elements, removing an entity from a Set is also easier and more performant.

It looks like you're trying to replicate Set behavior using an array, it would be more efficient to just use Set instead. Apart from possible performance boost (`Array.includes` is worst-case O(n), `Set.has` is O(1)) it would give clearer code - no need to check if object reference already exists in set it doesn't get duplicated since Set already enforces uniqueness of all of its elements, removing an entity from a Set is also easier and more performant.
Author
Member

the current naming is acceptable (this kind of naming is currently used in many modal libraries, i.e https://bootstrap-vue.js.org/docs/components/modal/#emitting-events-on-root, https://react-bootstrap.github.io/components/modal/). If you are really not comfortable with it, I can change to requestClose though

the current naming is acceptable (this kind of naming is currently used in many modal libraries, i.e https://bootstrap-vue.js.org/docs/components/modal/#emitting-events-on-root, https://react-bootstrap.github.io/components/modal/). If you are really not comfortable with it, I can change to `requestClose` though
Member

I'd prefer backdropClicked.

Both of the links you provided are more fleshed-out modals, which provide actual modal windows with buttons like "ok" "cancel" "close" (last one we should have actually in our modal windows/panels) so it makes a bit more sense to have "ok" "cancel" "close". On top of that vue modal you've linked seem to be actually stateful, i.e. it can keep track itself if it should be showing or not - it makes sense to emit an event signifying important change of internal state.

In this case we don't have state at all. I'd expect 'close' to be fired either after modal has hidden itself (which doesn't happen since hidden/shown state is controlled from outside) of if "close" button has been clicked in modal (which we won't have because it's not an actual Modal, more of a ModalView or something, idk), so it would make sense to give events less confusing names.

I'd prefer `backdropClicked`. Both of the links you provided are more fleshed-out modals, which provide actual modal windows with buttons like "ok" "cancel" "close" (last one we should have actually in our modal windows/panels) so it makes a bit more sense to have "ok" "cancel" "close". On top of that vue modal you've linked seem to be actually stateful, i.e. it can keep track **itself** if it should be showing or not - it makes sense to emit an event signifying important change of internal state. In this case we don't have state at all. I'd expect 'close' to be fired either after modal has hidden itself (which doesn't happen since hidden/shown state is controlled from outside) of if "close" button has been clicked in modal (which we won't have because it's not an actual Modal, more of a ModalView or something, idk), so it would make sense to give events less confusing names.
Author
Member

updated

updated
Author
Member

updated

updated

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pleroma/pleroma-fe!2241
No description provided.