* add modal code to Forem namespace, use showModal in the rate limit modal generator
* add cypress tests for both modals
* styling tweaks
* tidy up
* make sure modal trap selector is unique to page, update Modal JSDoc
* add additional jest test for focusTrapSelector
* fix following tags input a11y errors
* give hidden inputs unique ids
* update html element code in initScrolling, update test with new ids
* refactor
* trigger travis
* target the textfield inside the div in the test
* delete alt attribute on span
* delete role checkbox on button - add type button
* delete wrong aria label
* sidebar-nav as class not ID
* delete duplicate attr class on single story
* delete duplicate attr class sidebar nav
* Revert "delete role checkbox on button - add type button"
This reverts commit 456fa676ff4457ffa724e9a07a3f123149dc5f39.
* delete role checkbox and modidy spec login modal js
* no need for name in cypress test showloginmodal anymore
* add attr data-test-id
* replace attr defer with DOMContentLoaded event
* delete useless class
* better a11y approach for button and cypress tests
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* better a11y approach for button and cypress tests
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* discussion_r612278777 : change initialize article reactions js
* revert replacing `const` with `let`
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* revert replacing `const` with `let`
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* apply `aria-hidden` on all reaction svg
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* keep original text `Saved` for bookmark button
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* fix missing aria-label on load - reaction button
* Revert "replace attr defer with DOMContentLoaded event"
This reverts commit db6a7eec051c443c18c17e23cf331132b222011f.
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* Remove early call to setup local storage for user
The first thing the callInitializers function does is re-invoke
initializeLocalStorageRender, calling the same function twice (for a
different outcome?) seems like it's not effective.
I tried to trace down how long it had been that way, and came to the
very first commit in the repo -
301c6080e3, where the pattern already
existed, so it's unclear at what point (prior to 2018) this was added,
and what problem it was trying to solve.
If we inlined callInitializers (by renaming it initializePage and
deleting the bottom function), the duplication would be especially
evident. This is the only call site for callInitializers, which would
be the other reason we _might_ want to have redundancy.
* Inline function call
Since initializePage only acted as a new name for
callInitializers (immediately transferring control to the
callInitializer function), remove the wrapper function and rename
the *actual* code with the public name initializePage.
No logic/behavior should change, unless we were unit testing callInitializers.
* Shorten method by moving long list of logicless calls to a helper
"We don't want to make a habit of pandering to Code Climate and its
metrics blindly".
Appease the robot by moving about 20 lines of uninteresting sequential
code out of the initializePage function and into a "callInitializers"
function, which is also the name of the function I just inlined.
* Remove pro role on user, expose pro dashboard to all users as analytics
* Remove pro from Elasticsearch mappings
* Update user role docs to use :trusted over :pro
* Remove pro from Role model spec
* Remove more references to pro, as noted by @rhymes
* Fixed bug with templates not being inserted for comments.
* Removed some trailing white space from a heading.
* Added custom Cypress command to create an article.
* Added E2E tests for creating comments on an article.
* Fixed adding a comment issue caused by mention auto-complete.
* Fixed a selector for the E2E tests.
* Removed some unnecessary white space and also making code climate happy.
* Updated E2E test.
* Added a bit more to the E2E tests.
* Now validation for comment doesn't need to loop through textareas.
* Merge remote-tracking branch 'origin/master' into nickytonline/fix-comment-template-insertion-bug
* Removed a similar spec file and added tests to the other file.
* wip
* Fixed bug where a response template could not be submitted.
* Added/updated E2E tests.
* Reverted a small change to condition for showing the combobox popover.
* Undoing some white space changes as not related to PR.
* Trigger Build
* Put back article seed data as it's used in tests outside of comment tests.
* Revert "Revert "Add (updated) mention autocomplete to post comments (#13061)" (#13116)"
This reverts commit e28bde043c.
* Fix issues with editing comments and arrow key navigation, update tests
* Update app/javascript/crayons/MentionAutocompleteTextArea/MentionAutocompleteTextArea.jsx
Co-authored-by: Nick Taylor <nick@forem.com>
* refactor adding of attributes
* destructure
Co-authored-by: Nick Taylor <nick@forem.com>
* Working version of Runtime Filter with banner behind Feature Flag
* First attempt to add a cypress test
* Adds simplified test
* Cleanup global references
* Add multi-platform e2e test
* Use --runtime-display var with fallback to block
* Update app/assets/javascripts/initializers/runtime.js
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* Add FeatureFlag stub to fix unrelated specs
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* Ensure loggd out user data is not in the document
* Use delete operator to remove user property
Another function relies on this value not existing. If this property
exists, but is set to undefined, it will not behave as expected.
* Add tests to verify user data does not persist in the DOM after logout
* Update cypress/integration/loginFlows/userLogout.spec.js
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
* Fixup: Test localStorage for user data
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
* add mention autocomplete functionality to article and notification comments
* add cypress tests
* make sure entry transitions dont replay
* undo change to async useeffect covered in other pr
* move search into dynamic import
* exit search if enter pressed in middle of search term
* refactor button activation code
* add a space after a mention is selected
* tweak cypress test for reply to ensure it awaits combobox
* small refactor
* adds focusTrap wrapper to preact Modal component
* add view specific code for focus trap in admin add nav link
* add script to return a focustrap toggle, use in add nav link modal partial
* add trap to edit nav link modal
* add handlers for sign up modal
* update modal controller for admin section, update nav link modals to use
* update other admin modals with new data values for trap
* remove unneeded erb script file
* remove unneeded target
* refactor to remove extra unneeded param
* remove duplicate code, store getFocusTrapToggle in window
* trap focus in comment and bookmark showModal instances for not logged in user
* remove need for activator id
* clean up id refs no longer needed
* remove custom code and re-use focsu-trap lib
* update storybook docs
* update default export in focusTrap
* prevent close button click triggering a modal toggle twice
* ensure if user navigates from a modal the trap is deactivated
* add jsdoc comments and add dynamic import
* ensure admin controller modal traps are cleaned up on disconnect
* update sign up modal to use crayons
* update modal controller and admin nav links modals to use preact modal
* update profile fields modals for new controller
* tweak styling of sign up and admin modals to match previous
* update listings modal to use crayons modal, adapt focus trap to work with click outside
* memoize deactivate callback to ensure modal can be presented on first page load
* add missed focustrap changes
* fix focus trap issues in onboarding flow
* refactor onboarding focus trap, remove getFocusTrapToggle
* tweaks for styling and article modal toggle
* add click outside tests to modal
* add cypress tests for the login modal
* update liquid tag tests affected by change
* refactors to address review comments
* fix issue with login modal presented twice on comment add
* change ids to selectors in admin modals
* small pr comment refactors
* add listings e2e tests
* add nav link modal tests
* fix issue with help modal
* tweak to fix ui bug from merge
* remove context from showLoginModal
* rename toggleModal
* rename state property for clarity
Co-authored-by: Nick Taylor <nick@dev.to>
* Use grid instead of flex
* Use child margin instead of flex gap
* use .grid instead of .flex.flex-column
* Missed one conditional flex gap
* gap-2 safely deleted since there’s only one element
* Add class for crayons-btn-actions
This pattern occurs pretty often. Easy class addition and easy swap out once flex gap is supported in target browsers
* Use crayons-btn-actions
* Adjust styling to use negative margins
* apply crayons-btn-actions
* use margin-right instead of gap
* use .grid instead of .flex.flex-column
* use margin instead of gap for indicators/tooltips in headings
* remove unused class for clarity
* use flex and add margin to small element
* remove gap from flex container and add margin to figure
* crayons-article__main has neither flex nor grid thus gap has no effect
* fix typo
* use actual grid columns
* use gap instead of flex-column
* Apply crayons-btn-actions
* Fix modal window display
* Safari bein a real pain here
Apparently Safari uses a different model to calculate height than other browsers. who knew.
* change home page main id to main-ontent, update scroll, refresh and shortcut handlers
* update articles by timeframe test with new main-content id
* tidy up css
* Trigger Travis CI
* undo unneeded changes
* small refactors
* Improve keyboard a11y of header menu dropdown
This commit also includes some cleanup of unnecessary functions that seemed to degrade performance.
Closes https://github.com/forem/forem/issues/1154
* Add temporary focus style on navigation-button
* Put menu items in a list
* Adjust menu button based on VoiceOver testing
* Refactor menu logic to be reusable/work on touch
* Preserve admin link visibility
* Focus on first item on menu open
* Clean up some HTML and CSS
* Apply suggestions from code review
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
* Ensure menu hides on click outside
* Rename toggle function and adjust formatting
* Update nav button focus style
* Clean up padding on header avatar focus style
* Make button show focus state for keyboard only
Using .focus-visible:focus targets keyboard focus and eliminates a flash of the blue border on click before focus is moved to the child item (which also has no focus style on mouse click)
* Update app/views/layouts/_top_bar.html.erb
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
* Add some defensive programming
* Removed initializeTouchDevice from base.js.erb
* navigation-butt ID is now member-menu-button
* Moved all the logic from initializeTouchDevice.js into a pack file/utilities.
* committing re-ordered schema after setup
* add tests for initializeTouchDevice
* remove some unneeded html setup
* make sure menu doesn't close if user tabs back from sign out
* Revert "committing re-ordered schema after setup"
This reverts commit a41a1c861cca3b97d8a7b8a99268b8afaae9f028.
* optimized code
* small tweaks, only show outline when focused
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
Co-authored-by: rhymes <rhymes@hey.com>
Co-authored-by: Nick Taylor <nick@dev.to>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* Replace follows#update with follows#bulk_update
* Allow follows#bulk_update to receive multiple follows and remove follows#update
* Add FollowPolicy#bulk_update? and remove update?
* Combine save button into one in following_tag.html
* Rename follows_update_spec to follows_bulk_update_spec and update
* Update buildTagsHTML to conform to the view
* Allow scrolls down dashboard test to update multiple tag values
* Includes follower and followable in follows#bulk_update
* Mark and pass changed field.
* fix typo in html
* Update follows in transaction
* Extract js script to another file and update view
* Rename disableUnchangedButton.js to dashboardTagsDisableUnchangedButtons.js
* .
* .
* .
* .
* .
* specs
* specs
* .
* .
* merge
* moving cheese around
* layout
* .
* merge
* Fixed invalid selector for search.
* Fixed issue with URL not updating after a search.
* do things better
* kinda merge
* whoops
* whoops
* .
* .
* im a backend developer
* tooltips 1.0.1
* tooltips 1.0.1
* fix
* specs
* .
* reduce the spacing
* schema drop
* reverts
* revert
* reverts
* revert
* drop unused nav
* drop unused nav
* drop unused nav
* drop unused nav
* typos
* paths fixes
* speeding up JS
* js
* search
* Reworked initializeTopBarIcons.js
* Reworked initializeNavigation.js
* Small refactor and updated exported function API docs.
* Fixed a bug I created when refactoring the top navigation icons.
* sidebar nav links
* spec
* Fixed issues with logged out experience for top nav icons.
* Small refactor of top nav icons.
* Small refactor and added some API docs.
* Added @testing-library/dom
* Added tests for top navigation utilities.
* spec
* spec
Co-authored-by: Nick Taylor <nick@dev.to>
* Adjust heading order
No skipping levels, adding an h1 for the homepage
* Add missing image alt text
* Update after PR review
* Update test snapshot
Co-authored-by: rhymes <rhymes@hey.com>