lddubeau / bootprompt Goto Github PK
View Code? Open in Web Editor NEWBootstrap powered alert, confirm and flexible dialog boxes
Home Page: https://lddubeau.github.io/bootprompt/
License: Other
Bootstrap powered alert, confirm and flexible dialog boxes
Home Page: https://lddubeau.github.io/bootprompt/
License: Other
The documentation needs to be revamped because:
It has bugs. I fixed some while producing 5.0 but I'm still finding bugs now, like hyperlinks that link nowhere.
It requires a lot of manual work to maintain. A change in the API always requires a change in the documentation. A lot of these double changes should in theory be unnecessary if the API documentation were generated from the TS code with typedoc. There's also the issue that writing something like a list requires <ul class="..."><li class="...">...</li>...</ul>
that's a lot of HTML typing. A markdown processor could reduce a lot of this work.
I've deleted composer.json
. It was no longer in sync with what bootprompt does. I don't develop with PHP so I don't know how to fix it, etc.
The latest version prior to deletion is here.
If folks want it resurrected someone will have to step up to maintain it.
@tiesont This repo contains the WIP on my fork of Bootbox.
I can make you a collaborator on this repo if you want. That's entirely up to you.
(If you look around the commits you'll see I first named the fork "bootshine", but after a while I found I hated that name, and then renamed again to "bootprompt".)
As I mentioned, I found that over 50 tests did not run in your branch. So when I turned them on, I found some failing tests and fixed the problems. You know much more than I do about the internals so you may have comments about my choices. I'm going to point out the relevant commits below.
9b953d7 This fix brings the code in conformance with what the test suite expected. But more importantly, it provides a nicer message to the user. Without the change, the user would get the error about min
having to be lower than max
but the real problem is that the other number is NaN.
ba1d9c2 The test did not take into account the behavior of a range that has min-max unset. See comment in the commit.
65e24e8 This is similar to the previous commit in that it fixes the test suite so that its expectations conform to the specs that determine how browsers are supposed to behave.
fc3a3e7 This test failed before I made this commit. I infer from the test that the intent is that if the user does not specify a default value, then first inputOption
should determine the default. However, browsers are such that if the user does not act on the select
element, then its value is never changed and remains what it was at creation, an empty string.
The cases above were disconnects between the code and the test suite, but I found an additional issue. I don't think there's a specific line in Bootstrap's documentation that says so, but the de facto standard that I've seen in constructing modals is to take the button which has the class btn-primary
as the "default action" for the modal. Being the default action, it should be the button that is focused when the modal shows up. In Bootbox 4, it worked that way. So I set up my modals with btn-primary
for the button which is safest. For instance, if someone is about to overwrite data, my app would ask "Do you want to overwrite this data?" and "No" would be the btn-primary
. If the user just hits ENTER after the modal shows up, the data has not been overwritten and the user can try again if they really meant to overwrite the data.
On your branch, this is flipped around because the focus is given to the bootbox-accept
button. After I started using your branch, all the modals I had that would ask for confirmation before doing something risky would focus the button which makes irreversible changes. In the example I gave above, "Yes" would be focused and if the user just hit ENTER, they'd do the irreversible change. (Yes, there are backups but it's a pain to have to go to a backup to recover the data.)
So in my fork I've changed the code back to focus btn-primary
instead of bootprompt-accept
.
The onEscape
option is a mess. Some problems:
The documentation implies that it should be usable on alert
, confirm
and prompt
, but right now it is silently ignored when used with these calls.
If the intent was that it should not be used on alert
, confirm
and prompt
, then the code does not show this intent, because there is no test to check whether it has been set before it is overwritten.
It is kinda-sorta linked with the processing of the close button (i.e. the button optionally shown in the modal header). If it is set to a callback then the callback will be called both when Escape is hit and when the close button is clicked. However, setting onEscape: false
prevents Escape from closing the modal but has no effect on what happens when the close button is clicked. This violates the principle of least surprise.
Another violation of the principle of least surprise. Adding to the confusion of the previous point, if onEscape
is set to a callback that returns false
, then it affects the handling of Escape and of the close button in exactly the same way: neither can close the modal. false
should really be a shorthand for () => false
and should behave the same way.
There's already evidence above that onEscape
should just be allowed on alert
, confirm
and prompt
, but here's an additional argument. An application designer may have decided for whatever reason that the application should not allow users to close modals by hitting escape. There's no reason that alert
, confirm
and prompt
should somehow be excluded from that decision.
Planned changes:
Allow the usage of onEscape
everywhere.
Add a new option onClose
which is used only for the close button.
This is a breaking change. Developers will have to check their usage of onEscape
and add onClose
where needed.
Hello there;
I'm in the process of shifting my focus from trying to maintain Bootbox to creating a new project in an organization (so that there's no "what happens when the owner disappears" problem again). Do you have any interest in joining https://github.com/BootboxJS and merging your work there? You've done most of what I've been wanting to do for a while, in your Typescript version, so it'd be great not to have to revisit work you've already completed.
If not, no offense taken.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These problems occurred while renovating this repository. View logs.
Warning
These dependencies are deprecated:
Datasource | Name | Replacement PR? |
---|---|---|
npm | popper.js |
|
npm | rollup-plugin-multi-entry |
|
npm | rollup-plugin-terser |
|
npm | tslint |
These updates are currently rate-limited. Click on a checkbox below to force their creation now.
chai
, @types/chai
)sinon-chai
, @types/sinon-chai
)@commitlint/cli
, @commitlint/config-angular
)mocha
, @types/mocha
)These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
jquery
, @types/jquery
)docs/frame.html
font-awesome 5.15.1
twitter-bootstrap 4.5.3
animate.css 4.1.1
jquery 3.5.1
twitter-bootstrap 4.5.3
package.json
@commitlint/cli ^11.0.0
@commitlint/config-angular ^11.0.0
@types/bootstrap ^4.5.1
@types/chai ^4.2.14
@types/jquery ^3.5.4
@types/mocha ^7.0.2
@types/sinon ^9.0.8
@types/sinon-chai ^3.2.5
@use-cdn/cli ^2.0.1
@use-cdn/karma ^2.0.1
chai ^4.2.0
conventional-changelog-cli ^2.1.1
deepcopy ^2.1.0
es6-promise ^4.2.8
eslint ^6.8.0
eslint-config-lddubeau-base ^5.2.0
eslint-plugin-import ^2.22.1
eslint-plugin-jsx-a11y ^6.4.1
eslint-plugin-prefer-arrow ^1.2.2
eslint-plugin-react ^7.21.5
eslint-plugin-simple-import-sort ^5.0.3
husky ^4.3.0
karma ^5.2.3
karma-browserstack-config ^1.0.1
karma-browserstack-launcher ^1.6.0
karma-chai ^0.1.0
karma-chrome-launcher ^3.1.0
karma-coverage-istanbul-instrumenter ^1.0.3
karma-coverage-istanbul-reporter ^3.0.3
karma-firefox-launcher ^1.3.0
karma-mocha ^2.0.1
karma-mocha-reporter ^2.2.5
karma-typescript-agile-preprocessor ^2.1.3
lite-server ^2.6.1
mocha ^7.2.0
popper.js ^1.16.1
renovate-config-lddubeau ^1.0.0
rollup ^2.33.2
rollup-plugin-multi-entry ^2.1.0
rollup-plugin-sourcemaps ^0.6.3
rollup-plugin-terser ^5.3.1
semver ^7.3.2
sinon ^7.5.0
sinon-chai ^3.5.0
tslint ^6.1.3
tslint-config-lddubeau ^4.1.2
typedoc ^0.19.2
typescript ^3.9.7
versync ^5.0.0
.travis.yml
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.